Browse Source

预归档库/管理库高级检索/收集库新增上传

master
xuhuajiao 3 weeks ago
parent
commit
5b2779c3bd
  1. 8
      src/views/archivesManage/managementLibrary/anjuan/tableList.vue
  2. 2
      src/views/archivesManage/managementLibrary/mixins/index.js
  3. 75
      src/views/archivesManage/managementLibrary/module/collectHeader.vue
  4. 30
      src/views/collectReorganizi/collectionLibrary/module/collectHeader.vue
  5. 101
      src/views/collectReorganizi/collectionLibrary/module/uploadOriginal/embedUpload.vue
  6. 35
      src/views/components/category/PreviewForm.vue
  7. 461
      src/views/prearchiveLibrary/advancedSearchModal.vue
  8. 76
      src/views/prearchiveLibrary/index.vue

8
src/views/archivesManage/managementLibrary/anjuan/tableList.vue

@ -351,6 +351,14 @@ export default {
this.loadTableData()
},
loadTableData() {
// localStorage
const savedSql = localStorage.getItem('advancedSearchSql')
console.log('savedSql', savedSql)
if (savedSql) {
this.query.condition = savedSql
} else {
this.query.condition = null
}
if (this.selectedCategory.arrangeType === 3) {
this.getViewTableList(2, this.parentsData.parentsProjectId, '')
} else if (this.selectedCategory.arrangeType === 1) {

2
src/views/archivesManage/managementLibrary/mixins/index.js

@ -23,6 +23,7 @@ export const manageLibraryCrud = {
timer: null,
query: {
search: null,
condition: null,
project_class: null,
archive_ctg_no: null
},
@ -161,6 +162,7 @@ export const manageLibraryCrud = {
'fonds_no': this.smartQuery.fonds_no,
'project_class': this.query.project_class,
'archive_ctg_no': this.query.archive_ctg_no,
'intelligenceSearch': this.query.condition,
'page': this.page.page,
'size': this.page.size,
'sort': this.arrySort,

75
src/views/archivesManage/managementLibrary/module/collectHeader.vue

@ -74,6 +74,7 @@
<!-- 搜索 -->
<el-input v-model="query.search" clearable size="small" :placeholder="placeholderType" prefix-icon="el-icon-search" style="width: 200px;" class="filter-item" @keyup.enter.native="handleSearch(collectLevel)" @clear="handleSearch(collectLevel)" />
<el-button class="filter-item filter-search" size="mini" type="success" icon="el-icon-search" @click="handleSearch(collectLevel)">搜索</el-button>
<el-button class="filter-item filter-search" size="mini" type="success" icon="el-icon-search" @click="handleAdvancedSearchClick">高级检索</el-button>
<el-button class="filter-item filter-refresh" size="mini" type="warning" icon="el-icon-refresh-left" @click="resetQuery">重置</el-button>
</div>
<div v-if="!isRecycle" class="collect-menu">
@ -174,6 +175,15 @@
</div>
</el-dialog>
<!-- 高级检索弹窗 -->
<AdvancedSearchModal
:selected-category="selectedCategory"
:collect-level="collectLevel"
:visible.sync="showAdvancedSearchModal"
:initial-conditions="advancedSearchConditions"
@search="handleAdvancedSearch"
/>
<!-- 绑定标签 -->
<binding-tag-dlg ref="bindingTag" :binding-id="selections[0] && selections[0].id" :binding-type="1" binding-txt="档案" @close-dialog="closeDialog" />
<!-- 装盒 / 分卷装盒 -->
@ -191,8 +201,9 @@
</div>
<div style="display: flex; justify-content: space-between; height: 30px; line-height: 30px; padding: 0 10px; ">
<span v-if="(isTitleType !== 2 && selectedCategory.arrangeType === 3 ) || ((isTitleType === 4 || isTitleType === 6) && selectedCategory.arrangeType === 2) || (isTitleType === 6 && selectedCategory.arrangeType === 1)" style="font-size: 12px;">{{ test }}</span>
<p v-if="query.condition" style="font-size: 12px; cursor: pointer; color: #409EFF;" @click="openAdvancedSearchModal">高级检索{{ advancedSearchDisplayText }}</p>
<span v-if="(isTitleType !== 2 && selectedCategory.arrangeType === 3 ) || ((isTitleType === 4 || isTitleType === 6) && selectedCategory.arrangeType === 2) || (isTitleType === 6 && selectedCategory.arrangeType === 1)" style="font-size: 12px;">{{ test }}</span>
<div v-if="!isRecycle && isTitleType === 6 && parentsData.authUtilize.endTime" style="font-size: 12px;">
<!-- 利用开始时间{{ parentsData.authUtilize.startTime | parseTime }} -->
利用结束时间{{ parentsData.authUtilize.endTime | parseTime }}
@ -245,13 +256,14 @@ import OnlineHandover from './onlineHandover/index'
import OffLineHandover from './offLineHandover/index'
import ExportZip from './exportZip/index'
import HandOverForm from './handOverForm'
import AdvancedSearchModal from '@/views/collectReorganizi/collectionLibrary/module/advancedSearchModal'
import qs from 'qs'
import { downloadFile, exportFile } from '@/utils/index'
import { mapGetters } from 'vuex'
export default {
name: 'CollectHeader',
components: { Treeselect, PreviewForm, BindingTagDlg, Print, PackingBox, OnlineHandover, OffLineHandover, ExportZip, HandOverForm },
components: { Treeselect, PreviewForm, BindingTagDlg, Print, PackingBox, OnlineHandover, OffLineHandover, ExportZip, HandOverForm, AdvancedSearchModal },
mixins: [manageLibraryCrud, crud()],
props: {
selectedCategory: {
@ -432,7 +444,9 @@ export default {
classifyOptions: [],
isDesFormType: 'manageArcives', //
arcId: null,
totalSumAll: 0
totalSumAll: 0,
showAdvancedSearchModal: false,
advancedSearchConditions: []
}
},
computed: {
@ -498,6 +512,31 @@ export default {
return '请选择项目阶段'
}
return '请选择项目分类'
},
//
advancedSearchDisplayText() {
if (!this.advancedSearchConditions || this.advancedSearchConditions.length === 0) {
return ''
}
return this.advancedSearchConditions.map(item => {
if (item.field) {
//
let keywordDisplay = item.keyWord
if (item.symbol === '包含' || item.symbol === '不包含') {
keywordDisplay = `'%${item.keyWord}%'`
} else if (item.keyWord && isNaN(parseInt(item.keyWord))) {
keywordDisplay = `'${item.keyWord}'`
}
return `${item.field} ${item.symbol} ${keywordDisplay}`
} else if (item.connector) {
//
return item.connector
} else if (item.bracket) {
//
return item.bracket
}
return ''
}).join(' ')
}
},
created() {
@ -520,6 +559,26 @@ export default {
this.getCategoryDataTree()
},
methods: {
//
handleAdvancedSearchClick() {
this.showAdvancedSearchModal = true
},
//
openAdvancedSearchModal() {
this.showAdvancedSearchModal = true
},
//
handleAdvancedSearch(condition) {
console.log('condition', condition)
console.log('this.parentsData', this.parentsData)
this.showAdvancedSearchModal = false
this.smartQuery = this.parentsData.smartQuery
// SQL
this.query.condition = condition.sql
//
this.advancedSearchConditions = condition.conditions
this.handleSearch(this.collectLevel)
},
getCategoryDataTree() {
FetchCategoryMenu().then(res => {
this.categoryMenu = res
@ -529,9 +588,14 @@ export default {
this.selectStatus = []
this.query = {
'search': null,
'condition': null,
'project_class': null,
'archive_ctg_no': null
}
this.advancedSearchConditions = []
// localStorage
localStorage.removeItem('advancedSearchConditions')
localStorage.removeItem('advancedSearchSql')
this.handleSearch(this.collectLevel)
},
// -
@ -539,9 +603,14 @@ export default {
this.classifyOptions = []
this.query = {
'search': null,
'condition': null,
'project_class': null,
'archive_ctg_no': null
}
this.advancedSearchConditions = []
// localStorage
localStorage.removeItem('advancedSearchConditions')
localStorage.removeItem('advancedSearchSql')
const params = {
'categoryId': this.selectedCategory.id
}

30
src/views/collectReorganizi/collectionLibrary/module/collectHeader.vue

@ -159,6 +159,7 @@
:is-title-type="isTitleType"
:collect-level="collectLevel"
:category-menu="categoryMenu"
:uploaded-file-data="uploadedFileData"
@close-dialog="closeDialog"
@handleForm="handleForm"
@formLoadingShow="formLoadingShow"
@ -170,8 +171,8 @@
ref="embedUploadRef"
:selected-category="selectedCategory"
:arc-id="arcId"
@on-upload-success="handleUploadSuccess"
@show-repeat-modal="handleShowRepeatModal"
@onUploadSuccess="handleUploadSuccess"
@showRepeatModal="handleShowRepeatModal"
/>
<div v-if="isAiAutoCategory" v-loading="aiResultCaLoading" style="flex: 1; margin-left: 10px; ">
<pre ref="typingContainer" v-highlightjs="displayedText">{{ displayedText }}</pre>
@ -495,7 +496,8 @@ export default {
repeatResponseData: {},
repeatData: [],
archiveInfo: {},
advancedSearchConditions: []
advancedSearchConditions: [],
uploadedFileData: null
}
},
computed: {
@ -709,6 +711,12 @@ export default {
}
// formPreviewData
this.formPreviewData = []
//
this.uploadedFileData = null
//
if (this.$refs.embedUploadRef) {
this.$refs.embedUploadRef.resetUploadedResults()
}
this.formIsAddOrEdit = type
@ -882,6 +890,10 @@ export default {
},
// form - submit
handlerArchivesSubmit(type) {
if (this.$refs.embedUploadRef && this.$refs.embedUploadRef.hasPendingFiles()) {
this.$message.warning('请先上传文件列表里的文件才可保存')
return
}
this.$refs.previewForm.submitForm('addOrUpdateForm', this.selectedCategory.id, this.quickPaperArcId, type)
},
handlerArchivesSubmitAndAdd() {
@ -917,6 +929,7 @@ export default {
this.isAiAutoCategory = false
this.displayedText = ''
this.isDialogClosed = true
this.uploadedFileData = null
if (this.reader) {
this.reader.cancel()
}
@ -928,14 +941,19 @@ export default {
// formPreviewData
this.formPreviewData = []
}
//
if (this.$refs.embedUploadRef) {
this.$refs.embedUploadRef.resetUploadedResults()
}
})
done()
},
//
handleUploadSuccess() {
//
console.log('嵌入版上传成功')
handleUploadSuccess(fileData) {
console.log('fileData', fileData)
this.uploadedFileData = fileData
console.log('嵌入版上传成功', this.uploadedFileData)
},
//
handleShowRepeatModal(repeatData) {

101
src/views/collectReorganizi/collectionLibrary/module/uploadOriginal/embedUpload.vue

@ -57,7 +57,6 @@
<script>
import { FetchCheckCaValidity } from '@/api/system/auth2'
import { FetchInitFileCategoryView } from '@/api/collect/collect'
import { mapGetters } from 'vuex'
import axios from 'axios'
import SparkMD5 from 'spark-md5'
@ -83,9 +82,9 @@ export default {
isCaValid: false,
isCheckingCa: false,
btnLoading: false,
originFileData: [],
repeatFileData: [],
tempSelectedFiles: null
tempSelectedFiles: null,
uploadedFileResults: []
}
},
computed: {
@ -134,14 +133,6 @@ export default {
this.isCheckingCa = false
}
},
async getFileList() {
const params = {
'categoryId': this.selectedCategory.id,
'archivesId': this.arcId
}
const res = await FetchInitFileCategoryView(params)
this.originFileData = res.returnlist || []
},
async handleDrop(e) {
if (this.isCheckingCa) {
this.showMessage('正在校验CA证书,请稍候...', 'warning')
@ -155,13 +146,13 @@ export default {
const selectedFiles = Array.from(e.dataTransfer.files)
if (selectedFiles.length === 0) return
await this.getFileList()
const existingFileNames = this.originFileData.map(file => file.file_name)
const existingFileNames = this.fileList.map(item => item.file.name)
this.repeatFileData = selectedFiles.filter(file => existingFileNames.includes(file.name))
if (this.repeatFileData.length > 0) {
this.tempSelectedFiles = selectedFiles
this.$emit('show-repeat-modal', this.repeatFileData)
this.showMessage('文件上传列表已有相关文件', 'warning')
this.$emit('showRepeatModal', this.repeatFileData)
return
}
@ -180,15 +171,16 @@ export default {
}
const selectedFiles = Array.from(e.target.files)
console.log('selectedFiles', selectedFiles)
if (selectedFiles.length === 0) return
await this.getFileList()
const existingFileNames = this.originFileData.map(file => file.file_name)
const existingFileNames = this.fileList.map(item => item.file.name)
this.repeatFileData = selectedFiles.filter(file => existingFileNames.includes(file.name))
if (this.repeatFileData.length > 0) {
this.tempSelectedFiles = selectedFiles
this.$emit('show-repeat-modal', this.repeatFileData)
this.showMessage('文件上传列表已有相关文件', 'warning')
this.$emit('showRepeatModal', this.repeatFileData)
e.target.value = ''
return
}
@ -214,8 +206,34 @@ export default {
this.showMessage('当前文件正在上传/合并中,无法删除', 'warning')
return
}
console.log('555fileItem', fileItem)
if (fileItem.successMsg) {
console.log('555fileItem.fileId', fileItem.fileId)
if (fileItem.fileId) {
this.uploadedFileResults = this.uploadedFileResults.filter(item => {
return item.fileId !== fileItem.fileId
})
} else {
const fileName = fileItem.file.name
this.uploadedFileResults = this.uploadedFileResults.filter(item => {
if (item.fileName) {
return item.fileName !== fileName
}
return true
})
}
console.log('555this.uploadedFileResults', this.uploadedFileResults)
this.$emit('onUploadSuccess', this.uploadedFileResults)
}
this.fileList.splice(index, 1)
},
resetUploadedResults() {
this.uploadedFileResults = []
},
hasPendingFiles() {
return this.fileList.some(item => !item.successMsg)
},
handleRepeatFile(type) {
if (!this.tempSelectedFiles) return
@ -223,7 +241,7 @@ export default {
if (type === 0) {
filesToUpload = this.tempSelectedFiles
} else {
const existingFileNames = this.originFileData.map(file => file.file_name)
const existingFileNames = this.fileList.map(item => item.file.name)
filesToUpload = this.tempSelectedFiles.filter(file => !existingFileNames.includes(file.name))
if (filesToUpload.length === 0) {
this.showMessage('当前所选文件去重后无可上传的文件', 'error')
@ -307,7 +325,6 @@ export default {
fileItem.uploading = true
fileItem.progress = 0
fileItem.errorMsg = ''
fileItem.successMsg = ''
try {
const fileMd5 = await this.calculateFileMd5(file)
@ -338,18 +355,29 @@ export default {
}
const pendingFiles = this.fileList.filter(item => !item.successMsg && !item.errorMsg)
if (pendingFiles.length === 0) {
this.showMessage('暂无待上传的文件!', 'warning')
const errorFiles = this.fileList.filter(item => item.errorMsg)
if (pendingFiles.length === 0 && errorFiles.length === 0) {
this.showMessage('所有文件均已上传成功!', 'success')
return
}
this.btnLoading = true
for (const fileItem of pendingFiles) {
if (errorFiles.length > 0) {
errorFiles.forEach(fileItem => {
fileItem.errorMsg = ''
fileItem.progress = 0
})
}
const filesToUpload = [...pendingFiles, ...errorFiles]
for (const fileItem of filesToUpload) {
await this.uploadFileChunks(fileItem)
}
const validFiles = this.fileList.filter(item => !item.errorMsg && item.progress === 100)
const validFiles = this.fileList.filter(item => !item.errorMsg && item.progress === 100 && !item.successMsg)
if (validFiles.length === 0) {
this.btnLoading = false
this.showMessage('无有效分片上传完成的文件!', 'error')
@ -418,14 +446,33 @@ export default {
'Content-Type': 'application/json'
}
})
console.log(response.data)
if (response.data.code === 200) {
this.showMessage('所有文件上传并合并成功', 'success')
validFiles.forEach(fileItem => {
const responseData = Array.isArray(response.data.data) ? response.data.data : [response.data.data]
validFiles.forEach((fileItem, index) => {
fileItem.successMsg = '上传成功!'
fileItem.merging = false
const matchedData = responseData[index]
console.log('matchedData', matchedData)
if (matchedData) {
fileItem.fileId = matchedData.fileId
}
})
this.$emit('onUploadSuccess')
console.log('response.data.data', response.data.data)
if (Array.isArray(response.data.data)) {
this.uploadedFileResults = [...this.uploadedFileResults, ...response.data.data]
} else if (response.data.data) {
this.uploadedFileResults.push(response.data.data)
}
this.$emit('onUploadSuccess', this.uploadedFileResults)
} else {
this.showMessage(`文件合并失败: ${response.data.message || '合并失败'}`, 'error')
}
@ -584,13 +631,13 @@ export default {
}
.success {
margin: 4px 0 0 0;
margin: 0 0 0 6px;
font-size: 12px;
color: #00C851;
}
.error {
margin: 4px 0 0 0;
margin: 0 0 0 6px;
font-size: 12px;
color: #ff4444;
}

35
src/views/components/category/PreviewForm.vue

@ -274,6 +274,10 @@ export default {
isAiCategory: {
type: Boolean,
default: false
},
uploadedFileData: {
type: [Array, Object],
default: null
}
},
@ -1530,22 +1534,49 @@ export default {
}
} else if (this.selectedCategory.arrangeType === 3 && this.activeIndex === 1 && this.archivesType === 'add') {
// parentsId === null
const fileIds = []
console.log('this.uploadedFileData', this.uploadedFileData)
if (this.uploadedFileData) {
if (Array.isArray(this.uploadedFileData)) {
this.uploadedFileData.forEach(item => {
if (item.fileId) {
fileIds.push(item.fileId)
}
})
} else if (this.uploadedFileData.fileId) {
fileIds.push(this.uploadedFileData.fileId)
}
}
params = {
'archivesId': this.arcId,
'archivesIds': null,
'categoryId': categoryId,
'parentsId': null,
'categoryLevel': this.collectLevel,
'jsonString': JSON.stringify(this.addOrUpdateForm)
'jsonString': JSON.stringify(this.addOrUpdateForm),
'fileIds': fileIds
}
} else {
const fileIds = []
if (this.uploadedFileData) {
if (Array.isArray(this.uploadedFileData)) {
this.uploadedFileData.forEach(item => {
if (item.fileId) {
fileIds.push(item.fileId)
}
})
} else if (this.uploadedFileData.fileId) {
fileIds.push(this.uploadedFileData.fileId)
}
}
params = {
'archivesId': this.arcId,
'archivesIds': null,
'categoryId': categoryId,
'parentsId': parentsId,
'categoryLevel': this.collectLevel,
'jsonString': JSON.stringify(this.addOrUpdateForm)
'jsonString': JSON.stringify(this.addOrUpdateForm),
'fileIds': fileIds
}
}
console.log(params)

461
src/views/prearchiveLibrary/advancedSearchModal.vue

@ -0,0 +1,461 @@
<template>
<el-dialog
:visible.sync="visible"
title="高级检索"
width="1000px"
:close-on-click-modal="false"
:modal-append-to-body="false"
append-to-body
:before-close="handleClose"
>
<div class="advanced-search-modal">
<el-form ref="form" inline :model="form" :rules="rules" size="small" label-width="70px">
<el-form-item label="字段名" prop="field">
<el-select v-model="form.field" value-key="id" style="width: 200px;">
<el-option v-for="item in fieldOptions" :key="item.id" :label="item.label" :value="item" />
</el-select>
</el-form-item>
<el-form-item label="运算符" prop="symbol">
<el-select v-model="form.symbol" value-key="value" placeholder="请选择" style="width: 200px;">
<el-option
v-for="item in symbolOptions"
:key="item.value"
:label="item.label"
:value="item"
/>
</el-select>
</el-form-item>
<el-form-item label="检索值" prop="keyWord" :rules="getKeywordRules">
<el-input v-model="form.keyWord" :type="inputType" style="width: 200px;" />
</el-form-item>
</el-form>
<div class="advanced-btn">
<el-button size="mini" @click="addConditionData"><i class="iconfont icon-xinzeng" />新增</el-button>
<el-button class="filter-refresh" size="mini" icon="el-icon-refresh-left" @click="resetQuery">重置</el-button>
</div>
<div class="search-condition">
<h4> 检索条件</h4>
<div class="condition-main">
<div class="condition-left">
<el-button size="mini" :disabled="currentIndex===null" @click="deltCurrent(currentIndex)"><i class="iconfont icon-shanchu" />删除</el-button>
<el-button size="mini" icon="el-icon-top" :disabled="currentIndex === 0" @click="moveUp(currentIndex)">上移</el-button>
<el-button size="mini" icon="el-icon-bottom" :disabled="currentIndex === conditionData.length - 1" @click="moveDown(currentIndex)">下移</el-button>
</div>
<ul id="condition-container-modal" class="condition-content">
<li v-for="(item, index) in conditionData" :id="'modal-element-id-' + index" :key="index" :class="currentIndex===index ? 'active': ''" @click="selectCurrent(index)">
<span style="color:#0348F3">{{ item.field }}</span>
<span style="color:#ED4A41; margin:0 4px">{{ item.symbol }}</span>
<span v-if="item.symbol && (item.symbol === '包含'|| item.symbol === '不包含')" class="keyword-style"><i>'%</i>{{ item.keyWord }}<i>%'</i></span>
<span v-else-if="item.keyWord && isNaN(parseInt(item.keyWord))" class="keyword-style"><i>'</i>{{ item.keyWord }}<i>'</i></span>
<span v-else class="keyword-style">{{ item.keyWord }}</span>
<span>{{ item.connector }}</span>
<span>{{ item.bracket }}</span>
</li>
</ul>
<div class="condition-right">
<el-button v-for="(item,index) in connectorList" :key="index" type="primary" size="mini" @click="addConnector(item)">{{ item }}</el-button>
</div>
</div>
</div>
</div>
<div slot="footer" class="dialog-footer">
<el-button @click="handleClose">取消</el-button>
<el-button type="primary" @click="handleSearch">检索</el-button>
</div>
</el-dialog>
</template>
<script>
import { FetchDoeditDocument } from '@/api/prearchiveLibrary/prearchiveLibrary'
export default {
name: 'AdvancedSearchModal',
props: {
visible: {
type: Boolean,
default: false
},
selectedDocument: {
type: Object,
default: () => ({})
},
initialConditions: {
type: Array,
default: () => []
}
},
data() {
return {
form: {
field: null,
symbol: null,
keyWord: null
},
fieldOptions: [],
symbolOptions: [
{
label: '包含',
value: 'like'
},
{
label: '不包含',
value: 'not like'
},
{
label: '等于',
value: '='
},
{
label: '不等于',
value: '!='
},
{
label: '为空',
value: 'is null'
},
{
label: '不为空',
value: 'is not null'
},
{
label: '大于',
value: '>'
},
{
label: '大于等于',
value: '>='
},
{
label: '小于',
value: '<'
},
{
label: '小于等于',
value: '<='
}
],
rules: {
field: [
{ required: true, message: '请选择字段名', trigger: 'change' }
],
symbol: [
{ required: true, message: '请选择运算符', trigger: 'change' }
]
},
conditionData: [],
currentIndex: null,
connectorList: ['并且', '或者', '(', ')']
}
},
computed: {
getKeywordRules() {
if ((this.form.symbol && this.form.symbol.label === '为空') || (this.form.symbol && this.form.symbol.label === '不为空')) {
return []
} else {
return [{ required: true, message: '请输入检索值', trigger: 'blur' }]
}
},
inputType() {
if (
this.form.symbol &&
(this.form.symbol.label === '大于' ||
this.form.symbol.label === '大于等于' ||
this.form.symbol.label === '小于' ||
this.form.symbol.label === '小于等于')
) {
return 'number'
} else {
return 'text'
}
}
},
watch: {
visible(newVal) {
if (!newVal) {
this.resetQuery()
this.conditionData = []
this.currentIndex = null
} else {
this.getFieldCommon()
if (this.initialConditions && this.initialConditions.length > 0) {
this.conditionData = JSON.parse(JSON.stringify(this.initialConditions))
}
}
}
},
mounted() {
this.getFieldCommon()
},
methods: {
resetQuery() {
if (this.$refs.form) {
this.$refs.form.resetFields()
}
},
addConditionData() {
this.$refs.form.validate((valid) => {
if (valid) {
const newConditionData = {}
newConditionData.field = this.form.field.label
newConditionData.fieldName = this.form.field.value
newConditionData.symbol = this.form.symbol.label
newConditionData.symbolCode = this.form.symbol.value
newConditionData.keyWord = this.form.keyWord
this.conditionData.push(newConditionData)
this.$nextTick(() => {
const container = document.getElementById('condition-container-modal')
container.scrollTop = container.scrollHeight
})
}
})
},
moveUp(index) {
if (index > 0) {
const temp = this.conditionData[index]
this.conditionData[index] = this.conditionData[index - 1]
this.conditionData[index - 1] = temp
this.currentIndex = index - 1
}
const targetElement = document.getElementById('modal-element-id-' + this.currentIndex)
if (targetElement) {
targetElement.scrollIntoView({ behavior: 'smooth', block: 'nearest' })
}
},
moveDown(index) {
if (index < this.conditionData.length - 1) {
const temp = this.conditionData[index]
this.conditionData[index] = this.conditionData[index + 1]
this.conditionData[index + 1] = temp
this.currentIndex = index + 1
}
const targetElement = document.getElementById('modal-element-id-' + this.currentIndex)
if (targetElement) {
targetElement.scrollIntoView({ behavior: 'smooth', block: 'nearest' })
}
},
deltCurrent(index) {
this.conditionData.splice(index, 1)
this.currentIndex = null
},
selectCurrent(index) {
if (this.currentIndex === index) {
this.currentIndex = null
} else {
this.currentIndex = index
}
},
addConnector(item) {
const newConditionData = {}
if (item === '并且' || item === '或者') {
newConditionData.connector = item
} else {
newConditionData.bracket = item
}
this.conditionData.push(newConditionData)
this.$nextTick(() => {
const container = document.getElementById('condition-container-modal')
container.scrollTop = container.scrollHeight
})
},
getFieldCommon() {
console.log('selectedDocument', this.selectedDocument)
const params = {
documentId: this.selectedDocument.id,
archivesId: null
}
console.log('params', params)
FetchDoeditDocument(params).then((data) => {
const showFiledAll = data.showFiled.filter(item => item.isSequence).sort((a, b) => a.isSequence - b.isSequence)
this.fieldOptions = showFiledAll
.filter(item => item.fieldName !== 'fonds_no' && item.fieldName !== 'fonds_name')
.map(item => {
return {
id: item.id,
label: item.fieldCnName,
value: item.fieldName
}
})
})
},
checkConditions(conditionData) {
let brackets = 0
let fields = 0
let connectors = 0
let previousTokenType = null
let hasValidConditionBetweenBrackets = false
for (var i = 0; i < conditionData.length; i++) {
const condition = conditionData[i]
let currentTokenType = ''
if (condition.hasOwnProperty('bracket')) {
currentTokenType = 'bracket'
brackets++
} else if (condition.hasOwnProperty('field')) {
currentTokenType = 'field'
fields++
if (brackets > 0) {
hasValidConditionBetweenBrackets = true
}
} else if (condition.hasOwnProperty('connector')) {
currentTokenType = 'connector'
connectors++
}
if (previousTokenType && currentTokenType) {
if ((previousTokenType === 'field' && currentTokenType === 'field') ||
(previousTokenType === 'connector' && currentTokenType === 'connector')) {
this.$message({ message: '条件之间缺少或且连接符', type: 'error', offset: 8 })
return null
}
}
previousTokenType = currentTokenType
}
if (brackets > 0 && !hasValidConditionBetweenBrackets) {
this.$message({ message: '请输入有效条件', type: 'error', offset: 8 })
return null
} else if (brackets > 0 && brackets % 2 !== 0) {
this.$message({ message: '括号不对称', type: 'error', offset: 8 })
return null
} else if (fields === 0) {
this.$message({ message: '请输入有效条件', type: 'error', offset: 8 })
return null
} else if (fields === 1 || connectors === fields - 1) {
const wheresql = this.conditionData.map(obj => {
if (obj.field) {
if (obj.symbol === '包含' || obj.symbol === '不包含') {
return obj.fieldName + ' ' + obj.symbolCode + " '%" + obj.keyWord + "%'"
} else if (obj.keyWord && isNaN(parseInt(obj.keyWord))) {
return obj.fieldName + ' ' + obj.symbolCode + " '" + obj.keyWord + "'"
} else {
return obj.fieldName + ' ' + obj.symbolCode + ' ' + obj.keyWord
}
} else if (obj.connector === '并且') {
return 'and'
} else if (obj.connector === '或者') {
return 'or'
} else {
return obj.bracket
}
}).join(' ')
return wheresql
} else {
this.$message({ message: '条件之间缺少或且连接符', type: 'error', offset: 8 })
return null
}
},
handleSearch() {
const wheresql = this.checkConditions(this.conditionData)
console.log('wheresql', wheresql)
if (wheresql) {
const conditions = JSON.parse(JSON.stringify(this.conditionData))
// localStorage
localStorage.setItem('advancedSearchConditions', JSON.stringify(conditions))
localStorage.setItem('advancedSearchSql', wheresql)
// SQL
this.$emit('search', {
sql: wheresql,
conditions: conditions
})
}
},
handleClose() {
this.$emit('update:visible', false)
}
}
}
</script>
<style lang='scss' scoped>
.advanced-search-modal {
.el-form--inline .el-form-item {
margin-right: 20px !important;
}
.advanced-btn {
display: flex;
justify-content: center;
margin-top: 15px;
.el-button {
margin-right: 10px;
}
}
.search-condition {
padding: 18px;
margin-top: 20px;
background: #F6F9FF;
border-radius: 3px;
border: 1px dashed #DCDFE6;
h4 {
margin: 0 0 17px 0;
padding-left: 25px;
color: #0C0E1E;
font-size: 14px;
font-weight: bold;
}
}
.condition-main {
display: flex;
justify-content: center;
flex-wrap: nowrap;
.condition-left {
display: flex;
flex-direction: column;
justify-content: center;
.el-button {
width: 76px;
margin: 5px 0;
::v-deep i.el-icon-top,
::v-deep i.el-icon-bottom {
font-size: 16px;
font-weight: bold;
}
}
}
.condition-content {
width: 500px;
height: 160px;
margin: 0 10px;
padding: 0;
background: #E6E8ED;
overflow: hidden;
overflow-y: scroll;
li {
display: flex;
justify-content: center;
flex-wrap: nowrap;
height: 32px;
line-height: 32px;
font-size: 14px;
text-align: center;
background-color: #fff;
border-bottom: 1px solid #E6E8ED;
cursor: default;
&:hover,
&:focus,
&.active {
background-color: #E8F2FF;
}
.keyword-style {
color: #2ECAAC;
i {
font-style: normal;
color: #545B65;
}
}
}
}
.condition-right {
display: flex;
flex-direction: column;
justify-content: center;
.el-button {
width: 64px;
margin: 5px 0;
background-color: #0348F3;
color: #fff;
}
}
}
}
</style>

76
src/views/prearchiveLibrary/index.vue

@ -8,10 +8,17 @@
<div class="elect-cont-right" style="position: relative;">
<!--工具栏-->
<div class="head-container">
<div class="head-search">
<div class="head-search" style=" align-items: center;">
<!-- 搜索 -->
<el-input v-model="query.search" clearable size="small" placeholder="输入题名搜索" prefix-icon="el-icon-search" style="width: 200px;" class="filter-item" @keyup.enter.native="crud.toQuery" />
<rrOperation />
<el-button class="filter-item filter-search" size="mini" type="success" icon="el-icon-search" @click="showAdvancedSearch">高级检索</el-button>
<el-button class="filter-item filter-refresh" size="mini" type="warning" icon="el-icon-refresh-left" @click="resetQuery">重置</el-button>
<div v-if="crud.query.intelligenceSearch" class="advanced-search-result">
<span style="font-size: 12px; color: #666;">高级检索</span>
<span style="font-size: 12px; color: #409EFF; margin-right: 10px; cursor: pointer;" @click="showAdvancedSearch">{{ advancedSearchDisplayText }}</span>
</div>
</div>
<crudOperation :permission="permission">
<template v-slot:left>
@ -144,6 +151,14 @@
</div>
</div>
</el-dialog>
<!--高级检索模态框-->
<AdvancedSearchModal
:visible.sync="advancedSearchVisible"
:selected-document="selectedDocument"
:initial-conditions="advancedSearchConditions"
@search="handleAdvancedSearch"
/>
</div>
</div>
</div>
@ -165,6 +180,7 @@ import batchFile from './module/batchFile'
import moveFile from './module/moveFile'
import detail from './module/detail'
import File from './file/index'
import AdvancedSearchModal from './advancedSearchModal'
import { exportFile } from '@/utils/index'
import qs from 'qs'
@ -172,7 +188,7 @@ import { mapGetters } from 'vuex'
export default {
name: 'PrearchiveLibrary',
components: { TreeList, PreviewForm, batchFile, moveFile, detail, Treeselect, rrOperation, crudOperation, pagination, File },
components: { TreeList, PreviewForm, batchFile, moveFile, detail, Treeselect, rrOperation, crudOperation, pagination, File, AdvancedSearchModal },
cruds() {
return [
CRUD({
@ -184,7 +200,7 @@ export default {
del: false,
download: false,
group: false,
reset: true
reset: false
},
queryOnPresenterCreated: false
})
@ -228,13 +244,40 @@ export default {
mousedownX: 0,
mousedownY: 0,
fileOriginal: null,
fileOneVisible: false
fileOneVisible: false,
advancedSearchVisible: false,
advancedSearchConditions: []
}
},
computed: {
...mapGetters([
'baseApi'
])
]),
//
advancedSearchDisplayText() {
if (!this.advancedSearchConditions || this.advancedSearchConditions.length === 0) {
return ''
}
return this.advancedSearchConditions.map(item => {
if (item.field) {
//
let keywordDisplay = item.keyWord
if (item.symbol === '包含' || item.symbol === '不包含') {
keywordDisplay = `'%${item.keyWord}%'`
} else if (item.keyWord && isNaN(parseInt(item.keyWord))) {
keywordDisplay = `'${item.keyWord}'`
}
return `${item.field} ${item.symbol} ${keywordDisplay}`
} else if (item.connector) {
//
return item.connector
} else if (item.bracket) {
//
return item.bracket
}
return ''
}).join(' ')
}
},
created() {
},
@ -244,6 +287,7 @@ export default {
this.crud.query.fondsAffiliation = this.selectedDocument.fondsId
this.crud.query.sort = this.arrySort
},
formLoadingShow(loadingType) {
this.archivesBtnLoading = loadingType
},
@ -251,6 +295,28 @@ export default {
this.selectedDocument = data
this.getInitDocumentsViewTable()
},
//
showAdvancedSearch() {
this.advancedSearchVisible = true
},
//
handleAdvancedSearch(data) {
this.advancedSearchVisible = false
this.crud.query.intelligenceSearch = data.sql
this.advancedSearchConditions = data.conditions || []
this.crud.toQuery()
},
//
clearAdvancedSearch() {
this.crud.query.intelligenceSearch = null
this.advancedSearchConditions = []
this.crud.toQuery()
},
//
resetQuery() {
this.advancedSearchConditions = []
this.crud.resetQuery()
},
//
getInitDocumentsViewTable() {
PrearchiveCrud.FetchInitDocumentsViewTable({ documentId: this.selectedDocument.id }).then(data => {

Loading…
Cancel
Save