取消
diff --git a/src/neo4j.js b/src/neo4j.js
index dae94b6..536f5e1 100644
--- a/src/neo4j.js
+++ b/src/neo4j.js
@@ -1,41 +1,68 @@
import neo4j from 'neo4j-driver'
-
+// process.env.NODE_ENV === 'production' ? window.g.ApiUrl : process.env.VUE_APP_BASE_API
+const linkSrc = 'http://192.168.99.107:11100'
+const ip = linkSrc.split(':')[1].split('/').pop()
const driver = neo4j.driver(
- 'bolt://192.168.99.107:7687',
+ 'bolt://' + ip + ':7687',
neo4j.auth.basic('neo4j', 'ftzn83560792')
)
-export async function getGraphData() {
+export async function getGraphData(query) {
const session = driver.session()
console.log('session', session)
try {
- const result = await session.run('MATCH (n)-[r]->(m) RETURN n, r, m')
- // const result = await session.run('MATCH (n)-[r]->(m) RETURN n, r, m LIMIT 25')
+ // 这里可以根据实际情况切换查询语句
+ // const query = "MATCH path = (target:Archives {id: '0047B3542CE88B895E41DE'})-[r:HAS_KEYWORD*1..4]-(related:Archives) WHERE target <> related RETURN path, LENGTH(path)/2 AS depth"
+ // const query = "MATCH path = (target:Archives {id: '0047B3542CE88B895E41DE'})-[rels:HAS_KEYWORD*1..4]-(related:Archives) WHERE target <> related UNWIND relationships(path) AS r WITH startNode(r) AS n, r, endNode(r) AS m, length(path)/2 AS depth RETURN DISTINCT n, r, m;"
+ // const query = 'MATCH (n)-[r]->(m) RETURN n, r, m LIMIT 25'
+ const result = await session.run(query)
const nodes = []
const edges = []
console.log('result', result)
+
result.records.forEach(record => {
- const sourceNode = record.get('n')
- console.log('sourceNode', sourceNode)
- const targetNode = record.get('m')
- console.log('targetNode', targetNode)
- const relationship = record.get('r')
- console.log('relationship', relationship)
-
- // 添加节点
- if (!nodes.some(node => node.id === sourceNode.identity.low)) {
- // nodes.push({ id: sourceNode.identity.low, label: sourceNode.labels[0] })
- nodes.push({ id: sourceNode.identity.low, text: sourceNode.properties.title, type: sourceNode.labels[0] })
- }
- if (!nodes.some(node => node.id === targetNode.identity.low)) {
- // nodes.push({ id: targetNode.identity.low, label: targetNode.labels[0] })
- nodes.push({ id: targetNode.identity.low, text: targetNode.properties.title, type: targetNode.labels[0] })
- }
+ if (record.has('path')) {
+ const path = record.get('path')
+ console.log('path', path)
+ const nodesInPath = path.segments.map(segment => segment)
+
+ nodesInPath.forEach(item => {
+ const sourceNode = item.start
+ const targetNode = item.end
+
+ if (!nodes.some(n => n.id === sourceNode.identity.low)) {
+ nodes.push({ id: sourceNode.identity.low, text: sourceNode.properties.title, type: sourceNode.labels[0] })
+ }
- // 添加边
- edges.push({ from: sourceNode.identity.low, to: targetNode.identity.low, text: relationship.type })
+ if (!nodes.some(node => node.id === targetNode.identity.low)) {
+ nodes.push({ id: targetNode.identity.low, text: targetNode.properties.title, type: targetNode.labels[0] })
+ }
+
+ if (!edges.some(edge => edge.from === sourceNode.identity.low && edge.to === targetNode.identity.low)) {
+ edges.push({ from: sourceNode.identity.low, to: targetNode.identity.low, text: item.relationship.type })
+ }
+ })
+ } else if (record.has('n') && record.has('r') && record.has('m')) {
+ const sourceNode = record.get('n')
+ const targetNode = record.get('m')
+ const relationship = record.get('r')
+
+ // 添加节点
+ if (!nodes.some(node => node.id === sourceNode.identity.low)) {
+ nodes.push({ id: sourceNode.identity.low, text: sourceNode.properties.title, type: sourceNode.labels[0] })
+ }
+ if (!nodes.some(node => node.id === targetNode.identity.low)) {
+ nodes.push({ id: targetNode.identity.low, text: targetNode.properties.title, type: targetNode.labels[0] })
+ }
+
+ // 添加边
+ if (!edges.some(edge => edge.from === sourceNode.identity.low && edge.to === targetNode.identity.low)) {
+ edges.push({ from: sourceNode.identity.low, to: targetNode.identity.low, text: relationship.type })
+ }
+ }
})
+
console.log(nodes, edges)
return { nodes, edges }
} finally {
diff --git a/src/views/AIAssistant/AICataloging/index.vue b/src/views/AIAssistant/AICataloging/index.vue
index 2611b1d..63e0a64 100644
--- a/src/views/AIAssistant/AICataloging/index.vue
+++ b/src/views/AIAssistant/AICataloging/index.vue
@@ -37,19 +37,8 @@
@@ -102,7 +90,9 @@ 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'
+import { archivesUpload } from '@/utils/upload'
+import { mapGetters } from 'vuex'
export default {
name: 'AICataloging',
@@ -139,16 +129,7 @@ export default {
isDesFormType: 'arcives',
collectLevel: 3,
categoryMenu: [],
- aiFileOriginal: null,
- file: null, // 附件 change
- fileNames: '', // 附件 - name
- formatType: '', // 附件 - type
- postfix: '', // 附件 - 文件后缀
- fileSize: '', // 附件 - 大小
- filePath: '', // 附件 - path
- px: '', // 附件 - 分辨率
nowDate: '', // 当前时间
- fileJsonString: null,
aiLoading: false,
fileList: [],
aiJsonData: null,
@@ -159,6 +140,9 @@ export default {
}
},
computed: {
+ ...mapGetters([
+ 'baseApi'
+ ])
},
mounted() {
this.getCategoryDataTree()
@@ -335,7 +319,7 @@ export default {
})
},
// 选择附件
- async changeFile(e) {
+ async changeAiFile(e) {
// 替换文件时清空 aiJsonData
this.aiJsonData = null
this.currentLineIndex = 0
@@ -343,7 +327,7 @@ export default {
this.typingFinished = false
this.typingInterval = null
// if (this.typingInterval) {
- // clearInterval(this.typingInterval)
+ // clearInterval(this.typingInterval);
// }
const selectedFiles = Array.from(e.target.files)
@@ -400,8 +384,8 @@ export default {
fileInfo.px = res.width + 'px*' + res.height + 'px'
this.fileList.push(fileInfo)
- this.uploadSave()
}
+ this.FetchAiFileUplaod(this.fileList)
} else if (nonImageFiles.length > 0) {
if (existingNonImageFiles.length > 0) {
// 若已有非图片文件,直接替换
@@ -435,91 +419,57 @@ export default {
),
px: ''
}
-
this.fileList.push(fileInfo)
- this.uploadSave()
}
+ this.FetchAiFileUplaod(this.fileList)
}
- // 上传附件
- // reDocumentUpload(this.baseApi + '/api/re-document/uploadFile', this.file, this.selectedDocument.id).then(res => {
- // if (res.data.code === 200) {
- // this.filePath = res.data.data
- // this.uploadSave()
- // }
- // })
},
- // 上传附件 - 选择上传即保存
- 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)
-
- setTimeout(() => {
- const json = `{
- "fonds_no": "A001",
- "archival_category_code": "WSWJ",
- "archive_ctg_no": "SCGL",
- "archive_year": "2024",
- "retention": "永久",
- "item_no": "0005",
- "archive_no": "A001-WSWJ·SCGL-2024-Y-0005",
- "maintitle": "Windows下如何创建FTP文件夹",
- "keyword": "",
- "doc_no": "武汉飞天[2024]0005",
- "doc_id": "",
- "security_class": "",
- "secrecy_period": "",
- "doc_type": "",
- "serial_no": "",
- "emergency_degree": "",
- "created_date": "",
- "doc_department": "",
- "signer": "",
- "main_department": "",
- "copy_department": "",
- "printing_department": "",
- "printing_date": "",
- "release_level": "",
- "microfilm": "",
- "attachment": "",
- "annotation": "",
- "file_id": "",
- "software_environment": "",
- "hardware_environment": "",
- "disposal_type": "",
- "disposal_actor": "",
- "disposal_department": "",
- "disposal_date": "",
- "disposal_result": "",
- "medium_type": "",
- "medium_qty": "",
- "medium_unit": "",
- "medium_specs": "",
- "is_entity": 1,
- "id": "6C91AAD1F6D9940469F8B0"
- }`
+ FetchAiFileUplaod(files) {
+ this.nowDate = getCurrentTime()
+ const promiseArray = files.map(async(item, index) => {
+ const json = {}
+ json.file_name = item.name
+ json.file_size = item.size
+ json.file_type = item.postfix
+ // json.file_path = this.filePath[index].path
+ json.file_path = ''
+ json.archive_id = this.arcId
+ json.file_dpi = item.px
+ json.file_thumbnail = ''
+ json.create_time = this.nowDate
+ json.id = null
+ json.last_modified = item.file.lastModified
+ // json.digital_summary = null
+ // json.public_key = null
+ // json.private_key = null
+ return json
+ })
+ console.log('promiseArray', promiseArray)
+ // 原始得上传文件二进制
+ const fileDefault = files.map(item => item.file)
- this.aiJsonData = json
- this.startTypingEffect()
- }, 3000)
+ Promise.all(promiseArray)
+ .then((arrayUpload) => {
+ // 上传附件
+ archivesUpload(this.baseApi + '/api/collect/uploadAssistEnterFiles',
+ fileDefault,
+ this.selectedCategory.id,
+ this.arcId,
+ JSON.stringify(arrayUpload)
+ ).then(res => {
+ if (res.data.code === 200) {
+ this.$message({ message: res.data.data, type: 'success', offset: 8 })
+ // this.aiJsonData = res.data;
+ // this.startTypingEffect();
+ } else {
+ this.$message({ message: '上传附件失败', type: 'error', offset: 8 })
+ }
+ // this.handleClose()
+ })
+ })
+ .catch((error) => {
+ console.error(error)
+ })
},
startTypingEffect() {
const lines = this.aiJsonData.split('\n')
diff --git a/src/views/archiveKeeping/deviceManage/index.vue b/src/views/archiveKeeping/deviceManage/index.vue
index d402929..9db6c18 100644
--- a/src/views/archiveKeeping/deviceManage/index.vue
+++ b/src/views/archiveKeeping/deviceManage/index.vue
@@ -7,21 +7,21 @@