修复搜索中心跳转知识分享

This commit is contained in:
高嵩
2023-03-22 09:17:49 +08:00
parent 658f1ded2f
commit 810eaf8173
2 changed files with 255 additions and 251 deletions
@@ -1,7 +1,7 @@
<template> <template>
<div class="box"> <div class="box">
<div class="search-text-title"> <div class="search-text-title">
<span>{{$t('searchScope')}}:</span> <span>{{ $t('searchScope') }}:</span>
<span>{{ queryParam.selectValue }}</span> <span>{{ queryParam.selectValue }}</span>
</div> </div>
<a-checkbox-group v-model="checkboxText" v-if="conList.length > 0"> <a-checkbox-group v-model="checkboxText" v-if="conList.length > 0">
@@ -18,7 +18,7 @@
<span class="text-header-text" style="cursor: pointer" v-html="item.module_type"></span> <span class="text-header-text" style="cursor: pointer" v-html="item.module_type"></span>
</a-tooltip> </a-tooltip>
<a-tooltip placement="topLeft" overlayClassName="tooltip-index" :mouseEnterDelay="0.5"> <a-tooltip placement="topLeft" overlayClassName="tooltip-index" :mouseEnterDelay="0.5">
<template slot="title"> <template slot="title">
<span v-html="item.serial_number"></span> <span v-html="item.serial_number"></span>
</template> </template>
<span style="cursor: pointer" <span style="cursor: pointer"
@@ -27,16 +27,17 @@
v-html="item.serial_number"></span> v-html="item.serial_number"></span>
</a-tooltip> </a-tooltip>
<a-tooltip placement="topLeft" overlayClassName="tooltip-index" :mouseEnterDelay="0.5"> <a-tooltip placement="topLeft" overlayClassName="tooltip-index" :mouseEnterDelay="0.5">
<template slot="title"> <template slot="title">
<span v-html="item.title"></span> <span v-html="item.title"></span>
</template> </template>
<span class="text-header-text" v-if="item.title" style="cursor: pointer" v-html="item.title"></span> <span class="text-header-text" v-if="item.title" style="cursor: pointer" v-html="item.title"></span>
</a-tooltip> </a-tooltip>
<a-tooltip placement="topLeft" overlayClassName="tooltip-index" :mouseEnterDelay="0.5"> <a-tooltip placement="topLeft" overlayClassName="tooltip-index" :mouseEnterDelay="0.5">
<template slot="title"> <template slot="title">
<span v-html="item.file_name"></span> <span v-html="item.file_name"></span>
</template> </template>
<span class="text-header-text" v-if="item.file_name && item.module_type_flag == 'WDK'" style="cursor: pointer" <span class="text-header-text" v-if="item.file_name && item.module_type_flag == 'WDK'"
style="cursor: pointer"
v-html="item.file_name"></span> v-html="item.file_name"></span>
</a-tooltip> </a-tooltip>
<!-- <a-tooltip placement="topLeft" :mouseEnterDelay="0.5">--> <!-- <a-tooltip placement="topLeft" :mouseEnterDelay="0.5">-->
@@ -106,286 +107,288 @@
</template> </template>
<script> <script>
import { getAction, postAction, downloadFile } from '@/api/manage' import { getAction, postAction, downloadFile } from '@/api/manage'
import { Base64 } from 'js-base64' import { Base64 } from 'js-base64'
import { mapGetters } from 'vuex' import { mapGetters } from 'vuex'
export default { export default {
name: 'whole', name: 'whole',
data() { data() {
return { return {
checkboxText: [], checkboxText: [],
url: { url: {
getInfoList: 'search/document/getFullTextInfoList' getInfoList: 'search/document/getFullTextInfoList'
}, },
conList: [], conList: [],
total: 0, total: 0,
pageSize: 10, pageSize: 10,
downLoadFileUrl: window._CONFIG['domianPreviewURL'] + '/sys/common/download', downLoadFileUrl: window._CONFIG['domianPreviewURL'] + '/sys/common/download',
downLoadImgUrl: window._CONFIG['domianWebImgURL'] + '/sys/common/download', downLoadImgUrl: window._CONFIG['domianWebImgURL'] + '/sys/common/download',
pageNo: 1, pageNo: 1,
queryParam: {} queryParam: {}
} }
}, },
watch: { watch: {
checkboxText: function(value) { checkboxText: function(value) {
this.conList.forEach(val => {
val.checked = false
})
if (value.length > 0) {
this.conList.forEach(val => { this.conList.forEach(val => {
val.checked = false value.forEach(res => {
}) if (res === val.id) {
if (value.length > 0) { val.checked = true
this.conList.forEach(val => { }
value.forEach(res => {
if (res === val.id) {
val.checked = true
}
})
}) })
} })
this.conList = [...this.conList] }
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)
} }
}, },
mounted() { ResetSearch() {
this.conList = [] this.pageNo = 1
// if (!this.queryParam.selectValue) { this.checkboxText = []
// this.getList() this.queryParam = {}
// } this.getList()
}, },
methods: { fileClick(fileQuery) {
...mapGetters(['userInfo']), let fileName = fileQuery.file_name
checkedClick(item) { let index1 = fileName.lastIndexOf('.')
if (item.checked) { let index2 = fileName.length
this.checkboxText = this.checkboxText.filter(res => { let fileSuffix = fileName.substring(index1, index2)
return res !== item.id 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 { } else if (fileSuffix == '.docx' || fileSuffix == '.doc') {
this.checkboxText.push(item.id) 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.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(',')
} }
}, })
ResetSearch() { let checkboxText = JSON.parse(JSON.stringify(this.checkboxText))
this.pageNo = 1 let query = {
this.checkboxText = [] pageNo: this.pageNo,
this.queryParam = {} pageSize: this.pageSize,
this.getList() ids: checkboxText.join(','),
}, ...queryParam
fileClick(fileQuery) { }
let fileName = fileQuery.file_name postAction(this.url.getInfoList, query).then((res) => {
let index1 = fileName.lastIndexOf('.') if (res.success) {
let index2 = fileName.length this.conList = res.result.records
let fileSuffix = fileName.substring(index1, index2) if (this.conList && this.conList.length > 0) {
if (fileSuffix == '.pdf') { this.conList.forEach(val => {
window.open('/pdf/web/viewer.html?file=' + encodeURIComponent('/jero-boot/sys/common/pdf/viewFile?id=' + fileQuery.id.slice(0, 32) + '&userName=' + this.userInfo().username)) val.content = val.content.replace(/<img .*?>/g, '')
} else if (fileSuffix == '.docx' || fileSuffix == '.doc') { val.content = val.content.replace(/<\/?p[^>]*>/gi, '')
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') { this.total = res.result.total
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 { } else {
downloadFile('/sys/common/downLoadFile', fileQuery.file_name, { id: fileQuery.id.slice(0, 32) }) this.conList = []
} }
}, })
pageOnChange(page, pageSize) { },
this.pageNo = page monthlyReportClick(item) {
this.getList() let fileName = item.file_name
}, let index1 = fileName.lastIndexOf('.')
SizeChange(page, pageSize) { let index2 = fileName.length
this.pageNo = 1 let fileSuffix = fileName.substring(index1, index2)
this.pageSize = pageSize if (fileSuffix == '.pdf') {
this.getList() 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') {
searchData(value) { let url = window._CONFIG['onlinePreviewDomainURL'] + '?url=' + Base64.encode(this.downLoadFileUrl + '/' + item.file_id + fileSuffix)
this.queryParam.selectValue = value || undefined window.open(url, '_blank')
this.queryParam.selectValueTwo = undefined } else if (fileSuffix == '.xlsx' || fileSuffix == '.xls') {
this.getList() let url = window._CONFIG['onlinePreviewDomainURL'] + '?url=' + Base64.encode(this.downLoadFileUrl + '/' + item.file_id + fileSuffix)
}, window.open(url, '_blank')
searchDataTwo(value) { } else if (fileSuffix == '.png' || fileSuffix == '.jpeg' || fileSuffix == '.gif' || fileSuffix == '.jpg') {
this.queryParam.selectValueTwo = value let url = window._CONFIG['onlinePreviewDomainURL'] + '?url=' + Base64.encode(this.downLoadImgUrl + '/' + item.file_id + fileSuffix)
this.getList() window.open(url, '_blank')
}, }
getText(str) { },
let words = str.replace(/<[^<>]+>/g, '').replace(/&nbsp;/gi, '') //这里是去除标签 titleClick(item) {
//.replace(/\s/g, '') //这里是去除空格 if (item.module_type_flag == 'FGYB') {
return words this.monthlyReportClick(item)
}, } else if (item.module_type_flag == 'WTZSK') {
getList() { let id = item.id.slice(0, item.id.length - 4)
let queryParam = JSON.parse(JSON.stringify(this.queryParam)) this.$router.push({
Object.keys(queryParam).forEach(val => { path: '/problemknowledgeBase',
if (queryParam[val] instanceof Array) { query: {
queryParam[val] = queryParam[val].join(',') id: id
} }
}) })
let checkboxText = JSON.parse(JSON.stringify(this.checkboxText)) } else {
let query = { let newUrl = this.$router.resolve({
pageNo: this.pageNo, path: '/docManage/library/detail',
pageSize: this.pageSize, query: {
ids: checkboxText.join(','), id: item.id.slice(0, 32),
...queryParam title: item.title,
} serial_number: item.serial_number
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.replace(/<img .*?>/g, '')
val.content = val.content.replace(/<\/?p[^>]*>/gi,'')
})
}
this.total = res.result.total
} else {
this.conList = []
} }
}) })
}, window.open(newUrl.href, '_blank')
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 newUrl = this.$router.resolve({
path: '/problemKnowledgeBaseView',
query: {
id: item.id
}
})
window.open(newUrl.href, '_blank')
} 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> </script>
<style lang="less"> <style lang="less">
.highlight-class { .highlight-class {
color: #21c9cc; color: #21c9cc;
} }
.tooltip-index { .tooltip-index {
max-width: calc(100% - 300px) !important; max-width: calc(100% - 300px) !important;
.ant-tooltip-inner {
.ant-tooltip-inner {
color: #333; color: #333;
background-color: #fff !important; background-color: #fff !important;
}
.ant-tooltip-arrow::before {
background-color: #fff;
}
} }
.ant-tooltip-arrow::before {
background-color: #fff;
}
}
</style> </style>
<style scoped lang="less"> <style scoped lang="less">
.box { .box {
padding: 0 0 0 18px; padding: 0 0 0 18px;
box-sizing: border-box; box-sizing: border-box;
} }
.checkbox-left { .checkbox-left {
float: left; float: left;
position: absolute; position: absolute;
left: 0; left: 0;
top: 50%; top: 50%;
transform: translateY(-50%); transform: translateY(-50%);
} }
.text-text-right { .text-text-right {
padding: 19px 28px; padding: 19px 28px;
box-sizing: border-box; box-sizing: border-box;
margin-left: 38px; margin-left: 38px;
cursor: pointer; cursor: pointer;
} }
.null-input { .null-input {
background-color: #F2F4F8; background-color: #F2F4F8;
} }
.search-text-title { .search-text-title {
margin-bottom: 22px; margin-bottom: 22px;
} }
.text-header { .text-header {
margin-bottom: 11px; margin-bottom: 11px;
.text-header-text { .text-header-text {
margin-right: 52px; margin-right: 52px;
font-size: 16px; font-size: 16px;
font-weight: bold; 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; color: #040B29;
opacity: 0.7; display: inline-block;
overflow: hidden; max-width: 220px;
display: -webkit-box;
text-overflow: ellipsis; text-overflow: ellipsis;
/*! autoprefixer: off */ white-space: nowrap;
-webkit-box-orient: vertical; overflow: hidden;
-webkit-line-clamp: 4;
/*! autoprefixer: on;*/
text-justify: inter-ideograph;
word-break: break-all
} }
.page { /*span {*/
text-align: right; /* margin-right: 52px;*/
margin-top: 20px; /* font-size: 16px;*/
} /* font-weight: bold;*/
/* color: #040B29;*/
/* display: inline-block;*/
/* max-width: 500px;*/
/* text-overflow: ellipsis;*/
/* white-space: nowrap;*/
/* overflow: hidden;*/
/*}*/
}
.noData { .text-content {
width: 100%; font-size: 14px;
text-align: center; font-weight: 400;
line-height: 10; 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
}
::v-deep p { .page {
margin: 0; text-align: right;
padding: 0; margin-top: 20px;
} }
.noData {
width: 100%;
text-align: center;
line-height: 10;
}
::v-deep p {
margin: 0;
padding: 0;
}
</style> </style>
@@ -19,7 +19,8 @@
</div> </div>
<a-form-model-item class="itemModel" prop="projectVersion"> <a-form-model-item class="itemModel" prop="projectVersion">
<a-input class="box-input" <a-input class="box-input"
:disabled="true" oninput="javascript:this.value=this.value.replace(/[^\d]$/g,'')"
:maxLength="2"
v-model="formInline.projectVersion" v-model="formInline.projectVersion"
:placeholder="$t('PleaseEnter')+$t('projectVersion')"/> :placeholder="$t('PleaseEnter')+$t('projectVersion')"/>
</a-form-model-item> </a-form-model-item>