【update】一般检索

This commit is contained in:
danshihao
2024-06-21 18:12:29 +08:00
parent 46b0c454d1
commit d14d88b8c7
4 changed files with 86 additions and 20 deletions
+12 -2
View File
@@ -1,4 +1,4 @@
import { getAction, postAction } from './manage'
import { downFile, getAction, postAction } from './manage'
// 获取检索历史数据
const getSearchHistoryData = (params) => getAction('/home/lawsHomeNormalSearchHistory/page', params)
// 根据id删除检索历史
@@ -38,6 +38,13 @@ const saveQuickEntryModuleList = (params) => postAction('/home/lawsHomeQuickAcce
// 待办任务-列表
const getTodoList = (params) => getAction('/home/lawsHomeBacklogTask/queryBacklogTaskList', params)
// 一般检索-导出
const exportGeneralSearch = (params) => downFile('/home/lawsHomeSearch/normalSearchExportExcel', params)
// 高级检索-全部
const getAdvancedSearchAll = (params) => postAction('/home/lawsHomeSearch/getAdvancedSearchAll', params)
// 高级检索-条款
const getAdvancedSearchClause = (params) => postAction('/home/lawsHomeSearch/getAdvancedSearchClause', params)
export {
getSearchHistoryData,
deleteSearchHistoryById,
@@ -55,5 +62,8 @@ export {
getQuickEntryModuleList,
getQuickEntryList,
saveQuickEntryModuleList,
getTodoList
getTodoList,
exportGeneralSearch,
getAdvancedSearchAll,
getAdvancedSearchClause
}
+1 -1
View File
@@ -17,7 +17,7 @@ module.exports = {
standardState: 'Standard State',
standardGradeClassification: 'Standard Grade Classification',
all: 'All',
releaseDate: 'Release Date'
implementationDate: 'Release Date'
},
// 高级搜索
advancedSearch: {
+6 -3
View File
@@ -17,8 +17,10 @@ module.exports = {
standardState: '标准状态',
standardGradeClassification: '标准等级分类',
all: '全部',
releaseDate: '发布日期',
standardStatusSet: '标准状态设置'
implementationDate: '实施日期',
standardStatusSet: '标准状态设置',
viewText: '查看文本',
exportName: '一般检索导出'
},
// 高级搜索
advancedSearch: {
@@ -39,7 +41,8 @@ module.exports = {
itemsUnit: '项',
listEmpty: '列表为空',
pleaseEnterSearchContent: '请输入搜索内容',
maxSelectedNine: '最多选择9个模块'
maxSelected: '最多选择14个模块',
newFunction: '新增功能'
},
// 待办任务
todoTask: {
+67 -14
View File
@@ -27,11 +27,19 @@
<!-- 检索方式 -->
<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="18" class="option-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'))">
{{ $t('export') }}
</a-button>
</div>
</a-col>
</a-row>
<!-- 资源类型 -->
<a-row :gutter="24" class="filter-row">
@@ -80,15 +88,16 @@
<template #title>
<span v-html="item.title"></span>
</template>
<p class="result-title" v-html="item.title" @click="filePreviewAll(item)"></p>
<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>
<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.releaseDate') }} {{ item.releaseDate || global.emptyLine }}</p>
<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'">
<!-- 全文检索 -->
@@ -130,7 +139,7 @@ import {
getSearchParamNum,
getSearchParamNumFullText,
generalSearchTitleSearch,
generalSearchFullTextSearch
generalSearchFullTextSearch, exportGeneralSearch
} from '@/api/dashboard'
import { isHasPermission } from '@/utils/hasPermission'
import { mapGetters } from 'vuex'
@@ -176,10 +185,8 @@ export default {
// 资源类型可选择项
resourceTypeOptions: [
{ key: 'all', label: '全部' },
{ key: '1', label: '国内标准法规' },
{ key: '2', label: '海外标准法规' },
{ key: '3', label: '企业标准' },
{ key: '4', label: '动态消息' }
{ key: '1', label: '外来标准法规' },
{ key: '3', label: '企业标准' }
],
resourceTypeCurrent: 'all', // 资源类型当前选中项
// 标准状态设置可选择项
@@ -244,15 +251,55 @@ export default {
},
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 === EnterpriseStandardStatus.ABOLISH.value
return item.standardState.includes(EnterpriseStandardStatus.ABOLISH.value)
} else { // 国内标准 海外标准 判断 废止
return item.standardState === StandardStatus.ABOLISH.value
return item.standardState.includes(StandardStatus.ABOLISH.value)
}
},
@@ -769,7 +816,7 @@ export default {
color: #86909c;
}
.option-col {
width: calc(100% - 200px);
flex: calc(100% - 200px);
height: auto;
color: #1D2129;
display: flex;
@@ -789,10 +836,13 @@ export default {
color: @primary-color;
}
}
.operator-col {
flex: 100px;
}
}
// 选中项样式
.option-curr {
background: rgba(213, 44, 38, 0.08);
background: rgba(0, 100, 250, 0.08);
color: @primary-color;
border-radius: 4px 4px 4px 4px;
}
@@ -934,4 +984,7 @@ export default {
}
}
}
.right-btns {
float: right;
}
</style>