修改搜索中心的问题

This commit is contained in:
qq787203167
2022-03-16 14:18:18 +08:00
parent 17d3c0c51d
commit eaa219a460
3 changed files with 352 additions and 288 deletions
@@ -235,7 +235,6 @@
}) })
}, },
pdfPreview(fileQuery) { pdfPreview(fileQuery) {
console.log(fileQuery)
let fileName = fileQuery.fileName let fileName = fileQuery.fileName
let index1 = fileName.lastIndexOf('.') let index1 = fileName.lastIndexOf('.')
let index2 = fileName.length let index2 = fileName.length
@@ -93,6 +93,18 @@
</a> </a>
<a @click="handleCompare(record)" class="text-operation"> {{$t('Push')}}</a> <a @click="handleCompare(record)" class="text-operation"> {{$t('Push')}}</a>
</span> </span>
<span slot="serial_number" slot-scope="text,record">
<span v-html="record.serial_number"></span>
</span>
<span slot="titleName" slot-scope="text,record">
<span v-html="record.title"></span>
</span>
<span slot="file_name" slot-scope="text,record">
<a style="color:#21c9cc" @click="fileNameClick(record)">
{{record.file_name && record.file_name.length > 0 ? '查看文件' : '--'}}
</a>
</span>
file_name
<!-- 字符串超长截取省略号显示--> <!-- 字符串超长截取省略号显示-->
<!-- <span slot="templateContent" slot-scope="text">--> <!-- <span slot="templateContent" slot-scope="text">-->
<!-- <j-ellipsis :value="text" :length="25"/>--> <!-- <j-ellipsis :value="text" :length="25"/>-->
@@ -137,12 +149,22 @@
:url="url" :url="url"
ref="libraryPushRef" ref="libraryPushRef"
/> />
<a-modal
title="查看文件"
:width="500"
:visible="visible"
@ok="visible=false"
@cancel="visible=false"
>
<p v-for="(item,index) in fileList" :key="index"
class="fileText" :title="item.fileName" @click="fileClick(item)">{{ item.fileName }}</p>
</a-modal>
</div> </div>
</template> </template>
<script> <script>
import eventBUs from '../../../../common/event' import eventBUs from '../../../../common/event'
import { getAction, postAction } from '@/api/manage' import { getAction, postAction, downloadFile } from '@/api/manage'
import libraryPush from '@/components/libraryPush/index' import libraryPush from '@/components/libraryPush/index'
import moment from 'moment' import moment from 'moment'
@@ -155,6 +177,7 @@
return { return {
searchOption: [], searchOption: [],
queryParam: {}, queryParam: {},
visible: false,
dataSource: [], dataSource: [],
url: { url: {
queryCondition: 'search/document/queryCondition', queryCondition: 'search/document/queryCondition',
@@ -165,17 +188,20 @@
{ {
title: this.$t('standard'), title: this.$t('standard'),
align: 'center', align: 'center',
dataIndex: 'serial_number' dataIndex: 'serial_number',
scopedSlots: { customRender: 'serial_number' }
}, },
{ {
title: this.$t('title'), title: this.$t('title'),
align: 'center', align: 'center',
dataIndex: 'title' dataIndex: 'title',
scopedSlots: { customRender: 'titleName' }
}, },
{ {
title: this.$t('fileName'), title: this.$t('fileName'),
align: 'center', align: 'center',
dataIndex: 'fileName' dataIndex: 'file_name',
scopedSlots: { customRender: 'file_name' }
}, },
{ {
title: this.$t('status'), title: this.$t('status'),
@@ -258,7 +284,9 @@
total: 0, total: 0,
pageSize: 10, pageSize: 10,
pageNo: 1, pageNo: 1,
loading: false loading: false,
selectModel: '',
fileList: []
} }
}, },
watch: { watch: {
@@ -387,8 +415,9 @@
this.pageNo = 1 this.pageNo = 1
this.getInfoList() this.getInfoList()
}, },
searchData(data) { searchData(data, selectModel) {
this.queryParam = { ...data, ...this.queryParam } this.queryParam = { ...this.queryParam, ...data }
this.selectModel = selectModel
this.getInfoList() this.getInfoList()
}, },
getInfoList() { getInfoList() {
@@ -407,6 +436,11 @@
getAction(this.url.getInfoList, query).then((res) => { getAction(this.url.getInfoList, query).then((res) => {
if (res.success) { if (res.success) {
this.dataSource = res.result.records this.dataSource = res.result.records
this.dataSource.forEach((val) => {
if (val[this.selectModel] && val[this.selectModel].includes(this.queryParam[this.selectModel])) {
val[this.selectModel] = val[this.selectModel].replace(this.queryParam[this.selectModel], `<text style="color:#21c9cc">${this.queryParam[this.selectModel]}</text>`)
}
})
this.total = res.result.total this.total = res.result.total
this.loading = false this.loading = false
} else { } else {
@@ -418,6 +452,29 @@
this.pageNo = 1 this.pageNo = 1
this.queryParam = {} this.queryParam = {}
this.getInfoList() this.getInfoList()
},
fileNameClick(row) {
this.fileList = row.file_name || []
if (this.fileList.length > 0) {
this.visible = true
}
},
fileClick(fileQuery) {
let fileName = fileQuery.fileName
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))
} else if (fileSuffix == '.docx') {
let url = window._CONFIG['onlinePreviewDomainURL'] + '?url=' + encodeURIComponent(this.downLoadFileUrl + '/' + fileQuery.id)
window.open(url, '_blank')
} else if (fileSuffix == '.xlsx' || fileSuffix == '.xls') {
let url = window._CONFIG['onlinePreviewDomainURL'] + '?url=' + encodeURIComponent(this.downLoadFileUrl + '/' + fileQuery.id)
window.open(url, '_blank')
} else {
downloadFile('/sys/common/download', fileQuery.fileName, { id: fileQuery.id })
}
} }
} }
} }
@@ -605,4 +662,12 @@
.submitButtons { .submitButtons {
text-align: center; text-align: center;
} }
.fileText {
width: 100%;
cursor: pointer;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
</style> </style>
@@ -82,7 +82,7 @@
onSearch(event) { onSearch(event) {
this.queryParam[this.selectModel] = event this.queryParam[this.selectModel] = event
if (this.$refs.DocumentLibraryRef){ if (this.$refs.DocumentLibraryRef){
this.$refs.DocumentLibraryRef.searchData(this.queryParam) this.$refs.DocumentLibraryRef.searchData(this.queryParam,this.selectModel)
} }
}, },
onChange(e){ onChange(e){