Files
laws_chery_client/src/views/dashboard/search/GeneralSearch.vue
T

993 lines
34 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<template>
<a-spin :spinning="loading || selectOptionLoading">
<a-card :bordered="false" :bodyStyle="{height: cardHeight}">
<!-- 搜索框部分 -->
<div class="top-search-div">
<div class="top-search-div-content">
<a-input-search class="input-search"
:class="!isHasPermission('dashboard:generalSearch:search') ? 'search-no-btn' : ''"
:placeholder="$t('pleaseEnter')+$t('dashboard.generalSearch.queryCondition')"
v-model="searchValue"
:maxLength="50"
@search="onInputSearch()">
<a-button v-has="'dashboard:generalSearch:search'" type="primary" slot="enterButton">
<i class="iconfont icon-Searchbar_Search_icon"></i>
</a-button>
</a-input-search>
<!-- 高级检索 -->
<a class="search-link" @click="clickAdvancedSearch">{{ $t('dashboard.generalSearch.advancedSearch') }}</a>
<!-- 首页 -->
<a class="search-link" @click="clickHomePage">{{ $t('dashboard.generalSearch.homePage') }}</a>
<!-- 检索历史 -->
<!--<a class="search-link" @click="clickSearchHistory" v-has="'dashboard:generalSearch:searchHistory'">{{ $t('dashboard.generalSearch.searchHistory') }}</a>-->
</div>
</div>
<!-- 筛选区域 -->
<div class="filter-area-div" ref="filterArea">
<!-- 检索方式 -->
<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="10" 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-col :md="4" class="operator-col">
<div class="right-btns">
<!-- 导出 -->
<a-button icon="upload" type="primary" ghost @click="handleExportXls($t('dashboard.generalSearch.exportName'), '.xlsx')">
{{ $t('export') }}
</a-button>
</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>
<!-- 标准状态设置 -->
<a-row :gutter="24" class="filter-row">
<a-col :md="6" class="label-col"><span class="search_label">{{ $t('dashboard.generalSearch.standardStatusSet') }}</span></a-col>
<a-col :md="18" class="option-col">
<div v-for="item in standardStatusSetOptions" :key="item.key" class="option-div" :class="standardStatusSetCurrent === item.key ? 'option-curr' : ''" @click="standardStatusSetChange(item.key)">
{{ item.label }}
</div>
</a-col>
</a-row>
<!-- 其他筛选条件 -->
<template v-if="toggleSearchStatus">
<template v-for="(value, key) in selectOptionsKeys">
<div :key="key" v-if="selectOptions[value]" :gutter="24" class="filter-row">
<div class="label-col"><span class="search_label">{{ selectOptions[value].label }}</span></div>
<div class="option-col">
<div v-for="item in selectOptions[value].options" :key="item.itemValue" class="option-div" :class="selectOptions[value].current === item.itemValue ? 'option-curr' : ''" @click="selectOptionsChange(value, item.itemValue)">
<span>{{ item.itemText }}<span v-if="item.statisticsCount || item.statisticsCount === 0">(<span class="option-span-num">{{ item.statisticsCount }}</span>)</span></span>
</div>
</div>
</div>
</template>
</template>
</div>
<div class="toggle-div" @click="handleToggleChange" v-if="selectOptions && Object.keys(selectOptions).length !== 0">
<a-icon :type="toggleSearchStatus ? 'up' : 'down'"/>
{{ toggleSearchStatus ? $t('putAway') : $t('open') }}
</div>
<!-- 结果展示 -->
<template v-if="dataSource && dataSource.length > 0">
<!-- 查询结果展示区域 -->
<div class="result-wrapper">
<div class="result-div" v-for="item in dataSource" :key="item.id">
<div class="result-title-wrapper">
<!-- 正在搜索,标题根据搜索内容高亮显示 -->
<a-tooltip>
<template #title>
<span v-html="item.title"></span>
</template>
<p class="result-title" v-html="item.title" @click="goDetail(item)"></p>
</a-tooltip>
<div class="result-source-wrapper">
<p class="result-source">{{ (resourceTypeOptions.find(i => i.key === item.resourceType) || {}).label }}</p>
</div>
<div v-show="judgeAbolish(item)" class="result-source-wrapper" >
<p class="result-abolish">{{ StandardStatus.ABOLISH.text }}</p>
</div>
<p class="result-date">{{ $t('dashboard.generalSearch.implementationDate') }} {{ item.implementationDate || global.emptyLine }}</p>
<a-button :disabled="judgeAbolish(item)" @click="filePreviewAll(item)" style="margin-left: 8px;" type="primary" ghost>{{ $t('dashboard.generalSearch.viewText') }}</a-button>
</div>
<template v-if="retrievalModeCurrent === '1'">
<!-- 全文检索 -->
<div v-html="item.content" class="result-content-wrapper"></div>
</template>
<!--<template v-else>-->
<!-- <div v-if="item.resourceType !== '4'" class="result-content-wrapper">-->
<!-- {{ item.content }}-->
<!-- </div>-->
<!-- <div v-else v-html="item.content" class="result-content-wrapper"></div>-->
<!--</template>-->
</div>
</div>
<a-pagination
v-if="dataSource && dataSource.length > 0"
class="page-content"
show-quick-jumper
show-size-changer
v-model="ipagination.current"
:pageSize="ipagination.pageSize"
:pageSizeOptions="ipagination.pageSizeOptions"
:total="ipagination.total"
:showTotal="ipagination.showTotal"
@change="pageChange"
@showSizeChange="pageSizeChange"
/>
</template>
<a-empty class="empty-content" v-else />
<!-- 检索历史弹框 -->
<search-history-modal class="search-history-modal" ref="searchHistoryModal" @historySearch="historySearch"></search-history-modal>
</a-card>
</a-spin>
</template>
<script>
import SearchHistoryModal from './modules/SearchHistoryModal'
import {
getSearchParamNum,
getSearchParamNumFullText,
generalSearchTitleSearch,
generalSearchFullTextSearch, exportGeneralSearch
} from '@/api/dashboard'
import { isHasPermission } from '@/utils/hasPermission'
import { mapGetters } from 'vuex'
import { StandardStatus, EnterpriseStandardStatus } from '@/enums/commonEnums'
import {
getDomesticStandardFormModal,
getDomesticStandardDetail,
getOverseasStandardForm,
getOverseasStandardDocumentInfo
} from '../../../api/standardRegulationLibraryApi'
import {
getEnterpriseStandardAddForm,
getEnterpriseStandardInfoById,
isCanLookDetail
} from '../../../api/enterpriseStandardLibraryApi'
import Vue from 'vue'
import { previewPdf } from '../../../utils/previewPdf'
import { kkFilePreview } from '../../../utils/kkFilePreview'
import { ACCESS_TOKEN } from '../../../store/mutation-types'
import { getFileInfo } from '../../../api/api'
export default {
name: 'GeneralSearch',
components: { SearchHistoryModal },
computed: {
...mapGetters(['defaultHeight']),
cardHeight () {
return `calc(100vh - ${this.defaultHeight['user-info-height']} - ${this.defaultHeight['breadcrumb-height']}`
}
},
data () {
return {
selectOptionLoading: false, // 其他筛选条件部分的loading
loading: false,
searchValue: '', // 搜索框内容
toggleSearchStatus: false, // 检索条件收缩还是展开, false收缩状态
// 检索方式可选择项
retrievalModeOptions: [
{ key: '1', label: this.$t('dashboard.retrieval.fullSearch') },
{ key: '2', label: this.$t('dashboard.retrieval.titleSearch') }
],
retrievalModeCurrent: '1', // 检索方式当前选中项
// 资源类型可选择项
resourceTypeOptions: [
{ key: 'all', label: this.$t('dashboard.generalSearch.all') },
{ key: '1', label: this.$t('dashboard.generalSearch.foreignStandard') },
{ key: '3', label: this.$t('dashboard.generalSearch.enterpriseStandard') }
],
resourceTypeCurrent: 'all', // 资源类型当前选中项
// 标准状态设置可选择项
standardStatusSetOptions: [
{ key: '1', label: this.$t('dashboard.generalSearch.notIncludeAbolishedStandard') },
{ key: '2', label: this.$t('dashboard.generalSearch.includeAbolishedStandard') }
],
standardStatusSetCurrent: '1', // 标准状态设置当前选中项
selectOptions: {}, // 其他筛选条件
selectOptionsKeys: [
'standardClass', // 标准类别
'dynamicType', // 动力类型
'applicableVehicle', // 适用车辆类型
'standardProperty', // 标准类型
'standardState', // 状态
'standardCode', // 企业标准代号
'enterpriseStandardState', // 标准状态
'gradeClassification' // 标准等级分类
], // 其他筛选条件中所有的key,为了能按顺序遍历
dataSource: [],
ipagination: {
current: 1,
pageSize: 10,
pageSizeOptions: ['10', '30', '50', '100', '150', '200'],
showTotal: (total, range) => {
return range[0] + '-' + range[1] + ' ' + this.$t('total') + total + this.$t('strip')
},
total: 0,
showQuickJumper: true,
showSizeChanger: true
},
StandardStatus: StandardStatus,
getFormFunc: getDomesticStandardFormModal,
getDocumentInfoFunc: getDomesticStandardDetail
}
},
mounted () {
// 初始化检索方式
if (this.$route.query.type === 'title') {
// 标题检索
this.retrievalModeCurrent = '2'
} else if (this.$route.query.type === 'fullText') {
// 全文检索
this.retrievalModeCurrent = '1'
}
// 初始化资源类型
if (this.$route.query.resourceType) {
this.resourceTypeCurrent = this.$route.query.resourceType
}
// 初始化搜索内容
if (this.$route.query.searchValue) {
this.searchValue = this.$route.query.searchValue
}
// 资源类型不是全部,并且有搜索内容时获取筛选条件
if (this.resourceTypeCurrent !== 'all' && this.searchValue) {
this.initFilterData()
}
// 有搜索内容时,调用查询方法
if (this.searchValue) {
this.onSearch(1)
}
},
methods: {
isHasPermission,
// 导出
handleExportXls (fileName, fileSuffix = '.xls') {
if (!fileName || typeof fileName !== 'string') {
fileName = '导出文件'
}
const param = this.getSearchParam()
console.log('导出参数', param)
// 加一个大的提示
const modalLoading = this.$info({
title: '提示',
content: <span>正在导出,请稍候 <a-spin size="small" /></span>,
keyboard: false
})
// 把知道了这个按钮去掉
this.$nextTick(() => {
document.getElementsByClassName('ant-modal-confirm-btns')[0].style = 'display:none'
})
exportGeneralSearch(param).then((data) => {
if (!data) {
this.$message.warning('文件下载失败')
return
}
if (typeof window.navigator.msSaveBlob !== 'undefined') {
window.navigator.msSaveBlob(new Blob([data], { type: 'application/vnd.ms-excel' }), fileName + fileSuffix)
} else {
const url = window.URL.createObjectURL(new Blob([data], { type: 'application/vnd.ms-excel' }))
const link = document.createElement('a')
link.style.display = 'none'
link.href = url
link.setAttribute('download', fileName + fileSuffix)
document.body.appendChild(link)
link.click()
document.body.removeChild(link) // 下载完成移除元素
window.URL.revokeObjectURL(url) // 释放掉blob对象
}
}).finally(() => {
// 销毁这个提示
modalLoading.destroy()
})
},
// 判断是否是废止标准
judgeAbolish (item) {
// console.log('judgeAbolish')
// console.log('item', item)
// 全文检索后端返回的是 ",7," 这样的数据,不能直接判断等于
if (item.resourceType === '3') { // 企业标准 判断 废止
return item.standardState.includes(EnterpriseStandardStatus.ABOLISH.value)
} else { // 国内标准 海外标准 判断 废止
return item.standardState.includes(StandardStatus.ABOLISH.value)
}
},
// 获取要显示数量的筛选条件的数据
initFilterData (callback) {
const param = {}
// 资源类型
param.resourceType = this.resourceTypeCurrent === 'all' ? null : this.resourceTypeCurrent
// 检索方式
param.searchMode = this.retrievalModeCurrent
// 检索内容
param.searchContent = this.searchValue
// 标准状态设置
param.standardStateSet = this.standardStatusSetCurrent
let func
if (this.retrievalModeCurrent === '1') {
func = getSearchParamNumFullText
} else {
func = getSearchParamNum
}
this.selectOptionLoading = true
func(param).then(res => {
if (res.success) {
// 设置对象key为搜索时需要传给后端的字段名,以及设置选项和字段label
for (const item in res.result) {
if (res.result[item]) {
let label = ''
if (item === 'applicableVehicle') {
// 适用车辆类型
label = this.$t('dashboard.generalSearch.applicableVehicleType')
} else if (item === 'dynamicType') {
// 动力类型
label = this.$t('dashboard.generalSearch.dynamicType')
} else if (item === 'enterpriseStandardState') {
// 标准状态
label = this.$t('dashboard.generalSearch.standardState')
} else if (item === 'gradeClassification') {
// 标准等级分类
label = this.$t('dashboard.generalSearch.standardGradeClassification')
} else if (item === 'standardClass') {
// 标准类别
label = this.$t('dashboard.generalSearch.standardClass')
} else if (item === 'standardCode') {
// 企业标准代号
label = this.$t('dashboard.generalSearch.enterpriseStandardCode')
} else if (item === 'standardProperty') {
// 标准类型
label = this.$t('dashboard.generalSearch.standardType')
} else if (item === 'standardState') {
// 状态
label = this.$t('dashboard.generalSearch.state')
}
res.result[item].unshift({ itemText: this.$t('dashboard.generalSearch.all'), itemValue: 'all' })
this.selectOptions[item] = {
options: res.result[item],
label: label,
current: 'all'
}
} else {
// 该字段为null,删除原本有的该字段
if (Object.keys(this.selectOptions).includes(item)) {
delete this.selectOptions[item]
}
}
}
console.log(this.selectOptions)
callback && callback()
} else {
this.$message.warning(res.message)
this.selectOptions = {}
}
}).finally(() => {
this.selectOptionLoading = false
})
},
// 查询时获取参数
getSearchParam () {
const param = {}
// 检索方式
param.searchMode = this.retrievalModeCurrent
// 资源类型
param.resourceType = this.resourceTypeCurrent === 'all' ? null : this.resourceTypeCurrent
// 检索内容
param.searchContent = this.searchValue
// 标准状态设置
param.standardStateSet = this.standardStatusSetCurrent
// 其他筛选条件
for (const item in this.selectOptions) {
param[item] = this.selectOptions[item].current === 'all' ? null : this.selectOptions[item].current
}
// 分页
param.pageNo = this.ipagination.current
param.pageSize = this.ipagination.pageSize
return param
},
// 查询
onSearch (arg) {
if (arg === 1) {
this.ipagination.current = 1
}
const param = this.getSearchParam()
let func
if (this.retrievalModeCurrent === '1') {
// 是全文检索
func = generalSearchFullTextSearch
} else {
// 是标题检索
func = generalSearchTitleSearch
}
this.loading = true
func(param).then(res => {
if (res.success) {
this.dataSource = res.result.records
if (res.result.total) {
this.ipagination.total = res.result.total
} else {
this.ipagination.total = 0
}
} else {
this.$message.warning(res.message)
}
}).finally(() => {
this.loading = false
})
},
// 分页改变
pageChange (page) {
this.ipagination.current = page
this.onSearch()
},
pageSizeChange (current, size) {
console.log(current, size)
this.ipagination.current = current
this.ipagination.pageSize = size
this.onSearch()
},
onInputSearch () {
this.onSearch(1)
if (this.resourceTypeCurrent !== 'all') {
this.initFilterData()
}
},
// 检索方式改变
retrievalModeChange (key) {
this.retrievalModeCurrent = key
this.ipagination = {
current: 1,
pageSize: 10,
pageSizeOptions: ['10', '30', '50', '100', '150', '200'],
showTotal: (total, range) => {
return range[0] + '-' + range[1] + ' ' + this.$t('total') + total + this.$t('strip')
},
total: 0,
showQuickJumper: true,
showSizeChanger: true
}
// 更新其他筛选项的数据
if (this.resourceTypeCurrent !== 'all') {
this.initFilterData()
}
this.onSearch()
},
// 资源类型改变
resourceTypeChange (key) {
this.resourceTypeCurrent = key
this.ipagination = {
current: 1,
pageSize: 10,
pageSizeOptions: ['10', '30', '50', '100', '150', '200'],
showTotal: (total, range) => {
return range[0] + '-' + range[1] + ' ' + this.$t('total') + total + this.$t('strip')
},
total: 0,
showQuickJumper: true,
showSizeChanger: true
}
// 更新其他筛选项的数据
if (key !== 'all') {
this.initFilterData()
} else {
this.selectOptions = {}
}
this.onSearch()
},
// 标准状态设置改变
standardStatusSetChange (key) {
this.standardStatusSetCurrent = key
this.ipagination = {
current: 1,
pageSize: 10,
pageSizeOptions: ['10', '30', '50', '100', '150', '200'],
showTotal: (total, range) => {
return range[0] + '-' + range[1] + ' ' + this.$t('total') + total + this.$t('strip')
},
total: 0,
showQuickJumper: true,
showSizeChanger: true
}
if (this.resourceTypeCurrent !== 'all') {
this.initFilterData()
}
this.onSearch()
},
// 其他检索条件改变
selectOptionsChange (changeKey, value) {
console.log(changeKey, value)
this.selectOptions[changeKey].current = value
this.onSearch(1)
this.$forceUpdate()
},
// 收齐展开点击
handleToggleChange () {
this.toggleSearchStatus = !this.toggleSearchStatus
},
// 点击高级搜索按钮
clickAdvancedSearch () {
this.$router.push({
path: '/advancedSearch'
})
},
// 点击首页按钮
clickHomePage () {
this.$router.push({
path: '/dashboard/analysis'
})
},
// 点击检索历史
clickSearchHistory () {
this.$refs.searchHistoryModal.open()
},
// 跳转详情
goDetail (record) {
let path = ''
// 需要先判断是哪种标准
if (record.resourceType === '1') {
path = '/standardRegulationLibrary/foreignStandardDetailPage'
} else if (record.resourceType === '3') {
path = '/enterpriseStandardLibrary/enterpriseStandardDetail'
} else if (record.resourceType === '4') {
path = '/standardRegulationLibrary/DynamicMessageDetail'
}
this.$openPageNewSheet({
path: path,
query: {
id: record.id
}
})
},
// 根据类型,选择调用的函数
adjustFunc (type) {
switch (type) {
case '1':
this.getFormFunc = getDomesticStandardFormModal
this.getDocumentInfoFunc = getDomesticStandardDetail
break
case '2':
this.getFormFunc = getOverseasStandardForm
this.getDocumentInfoFunc = getOverseasStandardDocumentInfo
break
case '3':
this.getFormFunc = getEnterpriseStandardAddForm
this.getDocumentInfoFunc = getEnterpriseStandardInfoById
break
}
},
filePreviewAll (record) {
if (record.resourceType === '4') {
this.goDetail(record)
} else {
this.adjustFunc(record.resourceType)
if (record.resourceType === '3') { // 企标打开需要权限验证
console.log('record', record)
isCanLookDetail(record).then(res => {
console.log('res', res)
if (res.success) {
if (res.result) {
this.filePreview13(record)
} else {
this.$message.warn('您没有查看该文件的权限')
}
} else {
this.$message.warn(res.message)
}
})
} else {
this.filePreview13(record)
}
}
},
/**
* 按顺序打开最新的pdf或word
*/
async filePreview13 (record) {
console.log('filePreview', record)
// 获取并处理过程稿件数据
let res = await this.getFormFunc({ type: 1 })
if (!res.success) {
this.$message.warn(res.message)
console.log('getFormFunc error:', res)
return
}
console.log('res.result', res.result)
const data = res.result || {}
const form = data
const partList = Object.keys(data)
let part
const partZh = '过程稿件'
const partEn = 'Process Manuscript'
if (partList.includes(partEn))part = partEn
if (partList.includes(partZh))part = partZh
console.log('part', part)
const processManuscript = form[part]
console.log('过程稿件', processManuscript)
// 获取并处理详情数据
res = await this.getDocumentInfoFunc({ id: record.id, type: 1 })
if (!res.success) {
this.$message.warn(res.message)
console.log('getDocumentInfoFunc error:', res)
return
}
const detailData = Object.assign({}, res.result || {})
console.log('detailData', detailData)
// 选择合适的文件
let file = null
const pdfFileList = []
const docFileList = []
let newestFileList = []
let manuscriptName = '' // 记录找到哪个稿件就找到文件了
// 按照过程稿件顺序寻找文件
for (const formItem of processManuscript) {
// 只查看发布稿的文件
if (formItem.dbFieldName !== 'publish_of_original') {
continue
}
const keyId = formItem.dbFieldName
const keyName = formItem.dbFieldName + '_dictText'
if (!detailData[keyId]) continue
const idArray = detailData[keyId].split(',')
const nameArray = detailData[keyName].split(',')
// 每个过程中可能有多个文件
for (let i = 0; i < idArray.length; i++) {
const id = idArray[i]
const name = nameArray[i]
var suffix = name.substring(name.lastIndexOf('.') + 1).toLowerCase()
if (suffix === 'pdf') {
pdfFileList.push({ id, name, suffix })
}
if (suffix === 'docx') {
docFileList.push({ id, name, suffix })
}
}
// 一旦一个过程中找到pdf或者doc,就可以退出
if (pdfFileList.length > 0 || docFileList.length > 0) {
manuscriptName = formItem.dbFieldName
break
}
}
if (manuscriptName === 'publish_of_original' && record.resourceType === '3') {
// 是企标,在发布稿就找到了,合并pdf和doc文件列表排序
newestFileList = [...pdfFileList, ...docFileList]
} else {
newestFileList = pdfFileList // 默认从pdf里选最新的文件
if (pdfFileList.length === 0)newestFileList = docFileList // 如果没有pdf文件,就从doc文件里选
}
file = await this.selectNewestFile(newestFileList)
if (file === null) { // 没有找到文件就退出
console.log('没有找到符合要求的文件!')
this.$message.error('该标准暂无预览文件,请联系标准管理员。')
return
}
console.log('seletedFile', file)
// 是onlyOffice生成的,预览关联的pdf文件
if (file.pdfId) {
// 说明是onlyOffice生成的
const url = previewPdf(file.pdfId)
window.open(url)
return
}
// 预览选择的文件
const fileFullUrl = `${window._CONFIG.domianWebSocketURL}/sys/common/view/${file.id}?at=${Vue.ls.get(ACCESS_TOKEN)}&fullfilename=${file.name}`
console.log(fileFullUrl)
if (file.suffix === 'pdf') { // pdf预览
const url = previewPdf(file.id)
window.open(url)
return
}
kkFilePreview(fileFullUrl)// 其余可预览文件仍使用KKFile进行预览
},
/**
* 从文件列表里选择最新文件
* @param fileList
*/
async selectNewestFile (fileList) {
if (!fileList || fileList.length === 0) return null
if (fileList.length === 1) {
const res = await getFileInfo(fileList[0])
return { ...fileList[0], ...res.result }
}
const newFileList = []
// 获取时间信息
for (const file of fileList) {
const res = await getFileInfo(file)
newFileList.push({ ...file, ...res.result })
}
// 排序取出最新
newFileList.sort((a, b) => b.id - a.id) // 日期只精确到天,用id更能区分
console.log('newFileList', newFileList)
return newFileList[0]
},
// 检索弹框点击历史查数据
historySearch (searchObj) {
console.log('--------historySearch--------', searchObj)
// 清空其他筛选记录
this.selectOptions = {}
// 设置历史记录中的值
this.retrievalModeCurrent = searchObj.searchMode // 检索方式
this.resourceTypeCurrent = searchObj.resourceType || 'all' // 资源类型
this.searchValue = searchObj.searchValue // 搜索内容
if (this.resourceTypeCurrent !== 'all' && this.searchValue) {
this.initFilterData(() => {
const query = {
applicableVehicle: searchObj.applicableVehicle, // 适用车辆类型
dynamicType: searchObj.dynamicType, // 动力类型
enterpriseStandardState: searchObj.enterpriseStandardState, // 标准状态
gradeClassification: searchObj.gradeClassification, // 标准等级分类
standardClass: searchObj.standardClass, // 标准类别
standardCode: searchObj.standardCode, // 企业标准代号
standardProperty: searchObj.standardProperty, // 标准类型
standardState: searchObj.standardState // 状态
}
const queryObj = {}
for (const item in query) {
if (query[item]) {
queryObj[item] = query[item]
}
}
for (const item in queryObj) {
this.selectOptions[item].current = queryObj[item]
}
this.onSearch(1)
})
} else {
this.onSearch(1)
}
}
}
}
</script>
<style scoped lang="less">
@import '~@assets/less/common.less';
/deep/ .ant-card-body {
padding: 0;
//height: calc(100vh - 45px - 59px - 12px);
box-sizing: border-box;
overflow: hidden;
display: flex;
flex-direction: column;
}
// 搜索没有按钮
.search-no-btn {
/deep/ .ant-input {
border-right: 1px solid #d9d9d9;
border-top-right-radius: 4px;
border-bottom-right-radius: 4px;
}
}
// 头部搜索区域
.top-search-div {
width: 100%;
min-height: 98px;
background-image: url("../../../assets/image/searchPageBack.png");
background-size: 100% 100%;
background-repeat: no-repeat;
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 @primary-color;
}
}
// 筛选区域
.filter-area-div {
padding: 10px 20px;
//box-sizing: border-box;
max-height: 300px;
overflow-y: auto;
.filter-row {
height: auto;
line-height: 38px;
display: flex;
}
.label-col {
width: 200px;
text-align: left;
color: #86909c;
}
.option-col {
flex: calc(100% - 200px);
height: auto;
color: #1D2129;
display: flex;
align-items: center;
flex-wrap: wrap;
.option-div {
width: auto;
height: 26px;
line-height: 26px;
padding: 0 12px;
cursor: pointer;
margin: 6px 4px;
overflow: hidden;
white-space: nowrap;
}
.option-span-num {
color: @primary-color;
}
}
.operator-col {
flex: 100px;
}
}
// 选中项样式
.option-curr {
background: rgba(0, 100, 250, 0.08);
color: @primary-color;
border-radius: 4px 4px 4px 4px;
}
// 收缩展开容器
.toggle-div {
text-align: center;
cursor: pointer;
padding: 10px 0;
border-bottom: 1px solid #E5E6EB;
/deep/ .anticon {
height: 8px;
}
}
// 查询结果展示区域
.result-wrapper {
flex: 1;
overflow-y: auto;
padding: 16px 24px 0;
}
// 高亮样式
/deep/ .highlight-Es-class {
color: @primary-color;
word-wrap: break-word;
}
// 单个查询结果
.result-div {
width: 100%;
height: auto;
background: #F8F8F8;
border-radius: 4px 4px 4px 4px;
padding: 20px;
box-sizing: border-box;
margin-bottom: 16px;
.result-title-wrapper {
display: flex;
align-items: center;
p {
margin-bottom: 0;
}
.result-title {
color: #1D2129;
font-size: 18px;
font-family: PingFang SC-Semibold, PingFang SC;
font-weight: 600;
line-height: 28px;
margin-right: 20px;
max-height: calc(100% - 340px);
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
cursor: pointer;
}
.result-source-wrapper {
min-width: 100px;
}
.result-source {
display: inline-block;
width: auto;
height: 28px;
line-height: 28px;
background: @primary-color;
border-radius: 4px 4px 4px 4px;
font-size: 14px;
font-family: PingFang SC-Regular, PingFang SC;
font-weight: 400;
color: #FFFFFF;
padding: 0 8px;
}
.result-abolish {
margin-left: 10px;
display: inline-block;
width: auto;
height: 28px;
line-height: 28px;
background: #B7B7B7;
border-radius: 4px 4px 4px 4px;
font-size: 14px;
font-family: PingFang SC-Regular, PingFang SC;
font-weight: 400;
color: #FFFFFF;
padding: 0 8px;
}
.result-date {
min-width: 200px !important;
font-size: 16px;
font-family: PingFang SC-Regular, PingFang SC;
font-weight: 400;
color: #86909C;
line-height: 19px;
text-align: right;
white-space: nowrap;
flex: 1;
}
}
.result-content-wrapper {
width: 100%;
max-height: 40px;
font-size: 14px;
font-family: PingFang SC-Regular, PingFang SC;
font-weight: 400;
color: #1D2129;
line-height: 20px;
margin-top: 10px;
//display: -webkit-box; /* 将元素作为块级元素进行布局 */
//-webkit-box-orient: vertical; /* 垂直方向对齐 */
//-webkit-line-clamp: 2; /* 最多显示两行文本 */
overflow: hidden; /* 控制溢出内容不被显示 */
text-overflow: ellipsis; /* 当内容溢出时显示省略号 */
.result-field-span {
margin-right: 12px;
}
}
}
.empty-content {
margin-top: 20px;
}
// 分页
.page-content {
height: 32px;
text-align: right;
margin: 10px 24px 24px 0;
}
// 检索历史全屏下的样式
.search-history-modal.ant-modal-root.j-modal-box.fullscreen {
/deep/ .ant-spin-nested-loading {
height: 100%;
.ant-spin-container {
height: 100%;
}
.content-wrapper {
max-height: calc(100% - 20px);
}
}
}
.right-btns {
float: right;
}
</style>