Files
laws_weilai/jero-web/src/views/documentTools/searchCenter/components/whole.vue
T

398 lines
13 KiB
Java
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>
<div class="box">
<div class="search-text-title">
<span>{{ $t('searchScope') }}</span>
<span>{{ queryParam.selectValue }}</span>
</div>
<a-checkbox-group v-model="checkboxText" v-if="conList.length > 0">
<li v-for="(item,index) 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="titleClick(item)"
:class="{ 'null-input':item.checked }">
<div class="text-header">
<a-tooltip placement="topLeft" overlayClassName="tooltip-index" :mouseEnterDelay="0.5">
<template slot="title">
<span v-html="item.module_type"></span>
</template>
<span class="text-header-text" style="cursor: pointer" v-html="item.module_type"></span>
</a-tooltip>
<a-tooltip placement="topLeft" overlayClassName="tooltip-index" :mouseEnterDelay="0.5">
<template slot="title">
<span v-html="item.serial_number"></span>
</template>
<span style="cursor: pointer"
class="text-header-text"
v-if="item.serial_number && item.module_type_flag == 'WDK'"
v-html="item.serial_number"></span>
</a-tooltip>
<a-tooltip placement="topLeft" overlayClassName="tooltip-index" :mouseEnterDelay="0.5">
<template slot="title">
<span v-html="language == 'zh-cn'?item.title:item.title_en ? item.title_en : item.title"></span>
</template>
<span class="text-header-text"
v-if="item.title"
style="cursor: pointer"
v-html="language == 'zh-cn'?item.title:item.title_en ? item.title_en : item.title"></span>
</a-tooltip>
<a-tooltip placement="topLeft" overlayClassName="tooltip-index" :mouseEnterDelay="0.5">
<template slot="title">
<span v-html="item.file_name"></span>
</template>
<span class="text-header-text" v-if="item.file_name && item.module_type_flag == 'WDK'"
style="cursor: pointer"
v-html="item.file_name"></span>
</a-tooltip>
<!-- <a-tooltip placement="topLeft" :mouseEnterDelay="0.5">-->
<!-- </a-tooltip>-->
<!-- <a-tooltip placement="topLeft" :mouseEnterDelay="0.5">-->
<!-- </a-tooltip>-->
<a-tooltip placement="topLeft" :mouseEnterDelay="0.5">
</a-tooltip>
</div>
<!-- <a-tooltip placement="topLeft" overlayClassName="tooltip-index" -->
<!-- :mouseEnterDelay="0.5">-->
<!-- <template slot="title">-->
<!-- <span v-html="item.content"></span>-->
<!-- </template>-->
<div v-if="!queryParam.selectValue" class="text-content" v-html="item.content"
>
</div>
<!-- </a-tooltip>-->
<!-- <a-tooltip placement="topLeft" overlayClassName="tooltip-index" :mouseEnterDelay="0.5"-->
<!-- >-->
<!-- <template slot="title">-->
<!-- <span v-html="item.content"></span>-->
<!-- </template>-->
<div v-else-if="(item.file_text instanceof Array) && queryParam.selectValue"
class="text-content" v-html="item.content"></div>
<!-- </a-tooltip>-->
<!-- <a-tooltip placement="topLeft" overlayClassName="tooltip-index" :mouseEnterDelay="0.5"-->
<!-- >-->
<!-- <template slot="title">-->
<!-- <span v-html="item.content"></span>-->
<!-- </template>-->
<div v-else-if="!item.file_text && queryParam.selectValue"
class="text-content" v-html="item.content"></div>
<!-- </a-tooltip>-->
<!-- <a-tooltip placement="topLeft" overlayClassName="tooltip-index" :mouseEnterDelay="0.5" >-->
<!-- <template slot="title">-->
<!-- <span v-html="item.file_text"></span>-->
<!-- </template>-->
<!-- @click="checkedClick(item)"-->
<div v-else class="text-content" v-html="item.file_text">
</div>
<!-- </a-tooltip>-->
</div>
</div>
</li>
</a-checkbox-group>
<div class="noData" v-else>
暂无数据
</div>
<div class="page" v-if="conList.length > 0">
<a-pagination
:show-total="total => $t('total')+` ${total} `+$t('strip')"
show-quick-jumper
show-size-changer
:page-size.sync="pageSize"
:total="total"
:current="pageNo"
@change="pageOnChange"
@showSizeChange="SizeChange"
/>
</div>
</div>
</template>
<script>
import { getAction, postAction, downloadFile } from '@/api/manage'
import { Base64 } from 'js-base64'
import { mapGetters } from 'vuex'
export default {
name: 'whole',
data() {
return {
checkboxText: [],
url: {
getInfoList: 'search/document/getFullTextInfoList'
},
conList: [],
total: 0,
pageSize: 10,
downLoadFileUrl: window._CONFIG['domianPreviewURL'] + '/sys/common/download',
downLoadImgUrl: window._CONFIG['domianWebImgURL'] + '/sys/common/download',
pageNo: 1,
queryParam: {},
language:localStorage.getItem('language'),
}
},
watch: {
checkboxText: function(value) {
this.conList.forEach(val => {
val.checked = false
})
if (value.length > 0) {
this.conList.forEach(val => {
value.forEach(res => {
if (res === val.id) {
val.checked = true
}
})
})
}
this.conList = [...this.conList]
}
},
mounted() {
this.conList = []
// if (!this.queryParam.selectValue) {
// this.getList()
// }
},
methods: {
...mapGetters(['userInfo']),
checkedClick(item) {
if (item.checked) {
this.checkboxText = this.checkboxText.filter(res => {
return res !== item.id
})
} else {
this.checkboxText.push(item.id)
}
},
ResetSearch() {
this.pageNo = 1
this.checkboxText = []
this.queryParam = {}
this.getList()
},
fileClick(fileQuery) {
let fileName = fileQuery.file_name
let index1 = fileName.lastIndexOf('.')
let index2 = fileName.length
let fileSuffix = fileName.substring(index1, index2)
if (fileSuffix == '.pdf') {
window.open('/pdf/web/viewer.html?file=' + encodeURIComponent('/jero-boot/sys/common/pdf/viewFile?id=' + fileQuery.id.slice(0, 32) + '&userName=' + this.userInfo().username))
} else if (fileSuffix == '.docx' || fileSuffix == '.doc') {
let url = window._CONFIG['onlinePreviewDomainURL'] + '?url=' + Base64.encode(this.downLoadFileUrl + '/' + fileQuery.id.slice(0, 32) + fileSuffix)
window.open(url, '_blank')
} else if (fileSuffix == '.xlsx' || fileSuffix == '.xls') {
let url = window._CONFIG['onlinePreviewDomainURL'] + '?url=' + Base64.encode(this.downLoadFileUrl + '/' + fileQuery.id.slice(0, 32) + fileSuffix)
window.open(url, '_blank')
} else if (fileSuffix == '.png' || fileSuffix == '.jpeg' || fileSuffix == '.gif' || fileSuffix == '.jpg') {
let url = window._CONFIG['onlinePreviewDomainURL'] + '?url=' + Base64.encode(this.downLoadImgUrl + '/' + fileQuery.id.slice(0, 32) + fileSuffix)
window.open(url, '_blank')
} else {
downloadFile('/sys/common/downLoadFile', fileQuery.file_name, { id: fileQuery.id.slice(0, 32) })
}
},
pageOnChange(page, pageSize) {
this.pageNo = page
this.getList()
},
SizeChange(page, pageSize) {
this.pageNo = 1
this.pageSize = pageSize
this.getList()
},
searchData(value) {
this.queryParam.selectValue = value || undefined
this.queryParam.selectValueTwo = undefined
this.getList()
},
searchDataTwo(value) {
this.queryParam.selectValueTwo = value
this.getList()
},
getText(str) {
let words = str ? str.replace(/<[^<>]+>/g, '').replace(/&nbsp;/gi, '') : ''//这里是去除标签
//.replace(/\s/g, '') //这里是去除空格
return words
},
getList() {
let queryParam = JSON.parse(JSON.stringify(this.queryParam))
Object.keys(queryParam).forEach(val => {
if (queryParam[val] instanceof Array) {
queryParam[val] = queryParam[val].join(',')
}
})
let checkboxText = JSON.parse(JSON.stringify(this.checkboxText))
let query = {
pageNo: this.pageNo,
pageSize: this.pageSize,
ids: checkboxText.join(','),
...queryParam
}
postAction(this.url.getInfoList, query).then((res) => {
if (res.success) {
this.conList = res.result.records
if (this.conList && this.conList.length > 0) {
this.conList.forEach(val => {
val.content = val.content ? val.content.replace(/<img .*?>/g, '') :''
val.content = val.content ? val.content.replace(/<\/?p[^>]*>/gi, '') : ''
})
}
this.total = res.result.total
} else {
this.conList = []
}
})
},
monthlyReportClick(item) {
let fileName = item.file_name
let index1 = fileName.lastIndexOf('.')
let index2 = fileName.length
let fileSuffix = fileName.substring(index1, index2)
if (fileSuffix == '.pdf') {
window.open('/pdf/web/viewer.html?file=' + encodeURIComponent('/jero-boot/sys/common/pdf/viewFile?id=' + item.file_id + '&userName=' + this.userInfo().username))
} else if (fileSuffix == '.docx' || fileSuffix == '.doc') {
let url = window._CONFIG['onlinePreviewDomainURL'] + '?url=' + Base64.encode(this.downLoadFileUrl + '/' + item.file_id + fileSuffix)
window.open(url, '_blank')
} else if (fileSuffix == '.xlsx' || fileSuffix == '.xls') {
let url = window._CONFIG['onlinePreviewDomainURL'] + '?url=' + Base64.encode(this.downLoadFileUrl + '/' + item.file_id + fileSuffix)
window.open(url, '_blank')
} else if (fileSuffix == '.png' || fileSuffix == '.jpeg' || fileSuffix == '.gif' || fileSuffix == '.jpg') {
let url = window._CONFIG['onlinePreviewDomainURL'] + '?url=' + Base64.encode(this.downLoadImgUrl + '/' + item.file_id + fileSuffix)
window.open(url, '_blank')
}
},
titleClick(item) {
if (item.module_type_flag == 'FGYB') {
this.monthlyReportClick(item)
} else if (item.module_type_flag == 'WTZSK') {
let id = item.id.replace('base','')
this.$router.push({
path: '/problemknowledgeBase',
query: {
id: id
}
})
} else {
let newUrl = this.$router.resolve({
path: '/docManage/library/detail',
query: {
id: item.id.slice(0, 32),
title: item.title,
serial_number: item.serial_number
}
})
window.open(newUrl.href, '_blank')
}
}
}
}
</script>
<style lang="less">
.highlight-class {
color: #21c9cc;
}
.tooltip-index {
max-width: calc(100% - 300px) !important;
.ant-tooltip-inner {
color: #333;
background-color: #fff !important;
}
.ant-tooltip-arrow::before {
background-color: #fff;
}
}
</style>
<style scoped lang="less">
.box {
padding: 0 0 0 18px;
box-sizing: border-box;
}
.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;
cursor: pointer;
}
.null-input {
background-color: #F2F4F8;
}
.search-text-title {
margin-bottom: 22px;
}
.text-header {
margin-bottom: 11px;
.text-header-text {
margin-right: 52px;
font-size: 16px;
font-weight: bold;
color: #040B29;
display: inline-block;
max-width: 220px;
text-overflow: ellipsis;
white-space: nowrap;
overflow: hidden;
}
/*span {*/
/* margin-right: 52px;*/
/* font-size: 16px;*/
/* font-weight: bold;*/
/* color: #040B29;*/
/* display: inline-block;*/
/* max-width: 500px;*/
/* text-overflow: ellipsis;*/
/* white-space: nowrap;*/
/* overflow: hidden;*/
/*}*/
}
.text-content {
font-size: 14px;
font-weight: 400;
color: #040B29;
opacity: 0.7;
overflow: hidden;
display: -webkit-box;
text-overflow: ellipsis;
/*! autoprefixer: off */
-webkit-box-orient: vertical;
-webkit-line-clamp: 4;
/*! autoprefixer: on;*/
text-justify: inter-ideograph;
word-break: break-all
}
.page {
text-align: right;
margin-top: 20px;
}
.noData {
width: 100%;
text-align: center;
line-height: 10;
}
::v-deep p {
margin: 0;
padding: 0;
}
</style>