diff --git a/.env.production b/.env.production index 8adacef..1001a1a 100644 --- a/.env.production +++ b/.env.production @@ -2,10 +2,10 @@ ENV = 'production' # 如果使用 Nginx 代理后端接口,那么此处需要改为 '/',文件查看 Docker 部署篇,Nginx 配置 # 接口地址,注意协议,如果你没有配置 ssl,需要将 https 改为 http -VUE_APP_BASE_API = 'http://192.168.99.107:11100' +# VUE_APP_BASE_API = 'http://192.168.99.107:11100' # VUE_APP_BASE_API = 'http://27.19.215.77:11100' # VUE_APP_BASE_API = 'http://27.16.212.58:11100' -# VUE_APP_BASE_API = 'http://192.168.99.71:11110' +VUE_APP_BASE_API = 'http://192.168.99.71:11110' # 如果接口是 http 形式, wss 需要改为 ws VUE_APP_WS_API = 'ws://27.16.212.58:11110' VUE_APP_CAMERA_API = '192.168.99.107:3000' diff --git a/public/static/config.js b/public/static/config.js index f08cee0..e157579 100644 --- a/public/static/config.js +++ b/public/static/config.js @@ -1,8 +1,8 @@ window.g = { AXIOS_TIMEOUT: 10000, // ApiUrl: 'http://27.16.212.58:11100', // 配置服务器地址, - // ApiUrl: 'http://192.168.99.71:11110', - ApiUrl: 'http://192.168.99.107:11100', + ApiUrl: 'http://192.168.99.71:11110', + // ApiUrl: 'http://192.168.99.107:11100', // ParentPage: { // 后续看需求配置 // CrossDomainProxyUrl: '/Home/CrossDomainProxy', // BtnsApi: '/api/services/app/Authorization/GetBtns', diff --git a/src/views/AIAssistant/AICataloging/index.vue b/src/views/AIAssistant/AICataloging/index.vue index e540402..2611b1d 100644 --- a/src/views/AIAssistant/AICataloging/index.vue +++ b/src/views/AIAssistant/AICataloging/index.vue @@ -36,8 +36,8 @@
-
- +
+ +
+ + {{ aiLoading ? 'AI辅助著录识别中' : '选择文件' }} +
+ +
+
+ + {{ item.name }} + +
+
@@ -72,8 +84,8 @@

AI识别数据

-
-
{{ displayedText }}
+
+
{{ displayedText }}
保存 @@ -90,7 +102,7 @@ import crudCategory from '@/api/system/category/category' import CRUD, { presenter, header } from '@crud/crud' import PreviewForm from '@/views/components/category/PreviewForm' import { FetchInitCategoryInputFieldByPid, FetchCategoryMenu } from '@/api/system/category/category' -import { getCurrentTime } from '@/utils/index' +// import { getCurrentTime } from '@/utils/index' export default { name: 'AICataloging', @@ -127,12 +139,7 @@ export default { isDesFormType: 'arcives', collectLevel: 3, categoryMenu: [], - aiLoading: false, aiFileOriginal: null, - aiJsonData: null, - displayedText: '', - typingInterval: null, - typingFinished: false, file: null, // 附件 change fileNames: '', // 附件 - name formatType: '', // 附件 - type @@ -141,7 +148,14 @@ export default { filePath: '', // 附件 - path px: '', // 附件 - 分辨率 nowDate: '', // 当前时间 - fileJsonString: null + fileJsonString: null, + aiLoading: false, + fileList: [], + aiJsonData: null, + displayedText: '', + typingInterval: null, + typingFinished: false, + currentLineIndex: 0 } }, computed: { @@ -198,6 +212,7 @@ export default { children: item.categoryList.map(category => { return { label: category.cnName, + cnName: category.cnName, id: category.id, arrangeType: category.arrangeType, isType: category.isType, @@ -215,6 +230,7 @@ export default { return children.map(child => { return { label: child.cnName, + cnName: child.cnName, id: child.id, isType: child.isType, pid: child.pid, @@ -320,23 +336,110 @@ export default { }, // 选择附件 async changeFile(e) { - this.file = e.target.files[0] - this.fileSize = this.file.size - this.formatType = this.file.type.substring(0, this.file.type.indexOf('/')) - this.fileNames = this.file.name - this.postfix = this.file.name.substring( - this.fileNames.lastIndexOf('.') + 1, - this.fileNames.length - ) - if (this.formatType === 'image') { - const fileBase64 = await this.getBase64(this.file) - const res = await this.getImgPx(fileBase64) - this.px = res.width + 'px*' + res.height + 'px' - } else { - this.px = '' + // 替换文件时清空 aiJsonData + this.aiJsonData = null + this.currentLineIndex = 0 + this.displayedText = '' + this.typingFinished = false + this.typingInterval = null + // if (this.typingInterval) { + // clearInterval(this.typingInterval) + // } + + const selectedFiles = Array.from(e.target.files) + const imageFiles = selectedFiles.filter(file => file.type.startsWith('image/')) + const nonImageFiles = selectedFiles.filter(file => !file.type.startsWith('image/')) + + // 不允许同时选择图片和非图片文件 + if (imageFiles.length > 0 && nonImageFiles.length > 0) { + this.$message.error('不能同时选择图片和其他类型文件,请重新选择') + return } - this.uploadSave() + const existingImageFiles = this.fileList.filter(item => item.formatType === 'image') + const existingNonImageFiles = this.fileList.filter(item => item.formatType !== 'image') + + if (imageFiles.length > 0) { + if (existingImageFiles.length > 0) { + if (existingImageFiles.length + imageFiles.length > 3) { + // 若加入新图片会超过 3 张,清空已有图片 + this.fileList = this.fileList.filter(item => item.formatType !== 'image') + } + } else if (existingNonImageFiles.length > 0) { + // 若已有非图片文件,清空已有非图片文件 + this.fileList = this.fileList.filter(item => item.formatType === 'image') + } + + // 检查图片文件数量 + if (imageFiles.length > 3) { + this.$message.error('图片文件最多只能选择 3 个,请重新选择') + return + } + + for (const file of imageFiles) { + // 检查文件是否已存在 + if (this.fileList.some(item => item.name === file.name)) { + this.$message.warning(`文件 ${file.name} 已存在,请勿重复上传`) + continue + } + + const fileInfo = { + file: file, + size: file.size, + formatType: file.type.substring(0, file.type.indexOf('/')), + name: file.name, + postfix: file.name.substring( + file.name.lastIndexOf('.') + 1, + file.name.length + ), + px: '' + } + + const fileBase64 = await this.getBase64(file) + const res = await this.getImgPx(fileBase64) + fileInfo.px = res.width + 'px*' + res.height + 'px' + + this.fileList.push(fileInfo) + this.uploadSave() + } + } else if (nonImageFiles.length > 0) { + if (existingNonImageFiles.length > 0) { + // 若已有非图片文件,直接替换 + this.fileList = this.fileList.filter(item => item.formatType === 'image') + } else if (existingImageFiles.length > 0) { + // 若已有图片文件,清空已有图片文件 + this.fileList = this.fileList.filter(item => item.formatType !== 'image') + } + + // 检查非图片文件数量 + if (nonImageFiles.length > 1) { + this.$message.error('非图片文件最多只能选择 1 个,请重新选择') + return + } + + for (const file of nonImageFiles) { + // 检查文件是否已存在 + if (this.fileList.some(item => item.name === file.name)) { + this.$message.warning(`文件 ${file.name} 已存在,请勿重复上传`) + continue + } + + const fileInfo = { + file: file, + size: file.size, + formatType: file.type.substring(0, file.type.indexOf('/')), + name: file.name, + postfix: file.name.substring( + file.name.lastIndexOf('.') + 1, + file.name.length + ), + px: '' + } + + this.fileList.push(fileInfo) + this.uploadSave() + } + } // 上传附件 // reDocumentUpload(this.baseApi + '/api/re-document/uploadFile', this.file, this.selectedDocument.id).then(res => { // if (res.data.code === 200) { @@ -348,26 +451,26 @@ export default { // 上传附件 - 选择上传即保存 uploadSave() { this.aiLoading = true - this.nowDate = getCurrentTime() - const json = { - 'file_name': this.fileNames, - 'file_size': this.fileSize, - 'file_type': this.postfix, - 'file_path': this.filePath, - 'sequence': null, - 'archive_id': this.arcId, - 'file_dpi': this.px, - 'file_thumbnail': '', - 'create_time': this.nowDate, - 'id': null, - 'is_quote': null, - 'last_modified': this.file.lastModified - } - const arrayUpload = [] - arrayUpload.push(json) - this.aiFileOriginal = this.fileNames - this.fileJsonString = JSON.stringify(arrayUpload) - console.log(this.fileJsonString) + // this.nowDate = getCurrentTime() + // const json = { + // 'file_name': this.fileNames, + // 'file_size': this.fileSize, + // 'file_type': this.postfix, + // 'file_path': this.filePath, + // 'sequence': null, + // 'archive_id': this.arcId, + // 'file_dpi': this.px, + // 'file_thumbnail': '', + // 'create_time': this.nowDate, + // 'id': null, + // 'is_quote': null, + // 'last_modified': this.file.lastModified + // } + // const arrayUpload = [] + // arrayUpload.push(json) + // this.aiFileOriginal = this.fileNames + // this.fileJsonString = JSON.stringify(arrayUpload) + // console.log(this.fileJsonString) setTimeout(() => { const json = `{ @@ -416,24 +519,28 @@ export default { this.aiJsonData = json this.startTypingEffect() - this.aiLoading = false }, 3000) }, startTypingEffect() { const lines = this.aiJsonData.split('\n') - let currentLineIndex = 0 + this.currentLineIndex = 0 this.displayedText = '' this.typingFinished = false this.typingInterval = setInterval(() => { - if (currentLineIndex < lines.length) { - this.displayedText += lines[currentLineIndex] + '\n' - currentLineIndex++ + if (this.currentLineIndex < lines.length) { + this.displayedText += lines[this.currentLineIndex] + '\n' + this.currentLineIndex++ } else { clearInterval(this.typingInterval) + setTimeout(() => { this.typingFinished = true - this.$refs.previewForm.addOrUpdateForm = JSON.parse(this.aiJsonData) + if (this.aiJsonData) { + // this.$refs.previewForm.archivesType = 'add' + this.$refs.previewForm.addOrUpdateForm = JSON.parse(this.aiJsonData) + this.aiLoading = false + } }, 1000) } @@ -493,6 +600,7 @@ export default { .ai-category-main{ display: flex; justify-content: flex-start; + margin-top: 10px; .ai-des-left{ width: 740px; @@ -502,9 +610,8 @@ export default { flex: 1; } - .ai-des-form, - .ai-des-json{ - height: calc(100vh - 272px); + .ai-des-form{ + height: calc(100vh - 262px); overflow-y: auto; padding-right: 10px; } @@ -582,5 +689,7 @@ pre { border-radius: 4px; white-space: pre-wrap; word-wrap: break-word; + height: calc(100vh - 300px); + overflow-y: auto; } diff --git a/src/views/AIAssistant/AIKeywords/index.vue b/src/views/AIAssistant/AIKeywords/index.vue index b7acdd1..4d9fd45 100644 --- a/src/views/AIAssistant/AIKeywords/index.vue +++ b/src/views/AIAssistant/AIKeywords/index.vue @@ -405,6 +405,7 @@ export default { children: item.categoryList.map(category => { return { label: category.cnName, + cnName: category.cnName, id: category.id, arrangeType: category.arrangeType, isType: category.isType, @@ -422,6 +423,7 @@ export default { return children.map(child => { return { label: child.cnName, + cnName: child.cnName, id: child.id, isType: child.isType, pid: child.pid, diff --git a/src/views/AIAssistant/AIknowledgeGraph/index.vue b/src/views/AIAssistant/AIknowledgeGraph/index.vue index d57bd02..08367bf 100644 --- a/src/views/AIAssistant/AIknowledgeGraph/index.vue +++ b/src/views/AIAssistant/AIknowledgeGraph/index.vue @@ -126,6 +126,7 @@ export default { children: item.categoryList.map(category => { return { label: category.cnName, + cnName: category.cnName, id: category.id, arrangeType: category.arrangeType, isType: category.isType, @@ -143,6 +144,7 @@ export default { return children.map(child => { return { label: child.cnName, + cnName: child.cnName, id: child.id, isType: child.isType, pid: child.pid, diff --git a/src/views/archiveUtilize/archiveSearch/module/resultList.vue b/src/views/archiveUtilize/archiveSearch/module/resultList.vue index f2dda8f..9a5438d 100644 --- a/src/views/archiveUtilize/archiveSearch/module/resultList.vue +++ b/src/views/archiveUtilize/archiveSearch/module/resultList.vue @@ -156,6 +156,7 @@