Browse Source

bug修复/AI智能编研

master
xuhuajiao 3 months ago
parent
commit
0e83aee38a
  1. 12
      src/api/ai/ai.js
  2. 5
      src/views/AIAssistant/AIDigitalHuman/index.vue
  3. 245
      src/views/AIAssistant/AIIntelligentCoding/aiForm.vue
  4. 103
      src/views/AIAssistant/AIIntelligentCoding/index.vue
  5. 20
      src/views/AIAssistant/AIIntelligentCoding/str.json
  6. 2
      src/views/archiveUtilize/archiveEditing/module/materialSelected.vue
  7. 4
      src/views/collectReorganizi/batchConnection/index.vue
  8. 1
      src/views/collectReorganizi/collectionLibrary/mixins/index.js
  9. 57
      src/views/collectReorganizi/collectionLibrary/module/collectHeader.vue
  10. 150
      src/views/collectReorganizi/collectionLibrary/module/collectMoveFile/index.vue
  11. 205
      src/views/components/categoryTree.vue
  12. 36
      src/views/components/echarts/graph.vue

12
src/api/ai/ai.js

@ -34,7 +34,6 @@ export function FetchDelAssistEnter(data) {
} }
// AI辅助著录生成档案 // AI辅助著录生成档案
export function FetchHandleEnterAnalysis(data) { export function FetchHandleEnterAnalysis(data) {
return request({ return request({
url: 'api/ai/handleEnterAnalysis', url: 'api/ai/handleEnterAnalysis',
@ -51,4 +50,13 @@ export function FetchInitShowByCategory(params) {
}) })
} }
export default { FetchInitAssistEnter, FetchDoHandleEnterAnalysis, FetchInitAssistEnterTemp, FetchDelAssistEnter, FetchHandleEnterAnalysis, FetchInitShowByCategory }
// 编辑AI编研
export function FetchEditResearchAI(data) {
return request({
url: 'api/ai/editResearchAI',
method: 'post',
data
})
}
export default { FetchInitAssistEnter, FetchDoHandleEnterAnalysis, FetchInitAssistEnterTemp, FetchDelAssistEnter, FetchHandleEnterAnalysis, FetchInitShowByCategory, FetchEditResearchAI }

5
src/views/AIAssistant/AIDigitalHuman/index.vue

@ -15,7 +15,7 @@
</span> </span>
</p> </p>
<mavon-editor <mavon-editor
v-if="message.sender === 'bot' && message.isReplyFinished &&!message.isInterrupted"
v-if="message.sender === 'bot' && message.editorContent !== '' && message.isReplyFinished &&!message.isInterrupted"
ref="typingContainer" ref="typingContainer"
class="md" class="md"
:value="message.editorContent" :value="message.editorContent"
@ -78,7 +78,8 @@ export default {
content: '您好!请问有什么问题可以帮您解答吗?', content: '您好!请问有什么问题可以帮您解答吗?',
isTyping: false, isTyping: false,
isReplyFinished: true, isReplyFinished: true,
isInterrupted: false
isInterrupted: false,
editorContent: ''
}) })
}, },
methods: { methods: {

245
src/views/AIAssistant/AIIntelligentCoding/aiForm.vue

@ -6,8 +6,8 @@
<div class="setting-dialog"> <div class="setting-dialog">
<el-form ref="form" :model="form" size="small" inline label-width="80px" :rules="rules"> <el-form ref="form" :model="form" size="small" inline label-width="80px" :rules="rules">
<el-row> <el-row>
<el-form-item label="专题名称" prop="title">
<el-input v-model="form.title" style="width: 520px;" />
<el-form-item label="专题名称" prop="researchTitle">
<el-input v-model="form.researchTitle" style="width: 520px;" />
</el-form-item> </el-form-item>
<el-form-item label="编研类型" prop="researchType"> <el-form-item label="编研类型" prop="researchType">
<el-select v-model="form.researchType" placeholder="请选择" style="width: 225px;"> <el-select v-model="form.researchType" placeholder="请选择" style="width: 225px;">
@ -75,10 +75,13 @@
</div> </div>
<div class="file-right-info"> <div class="file-right-info">
<p>{{ fileName }}</p> <p>{{ fileName }}</p>
<span v-if="isUploading">解析中...</span>
<div v-else class="file-info">
<span>600KB</span>
<span>约2.9万字</span>
<span v-if="isAssisting">{{ fileLoadingText }}</span>
<div v-else>
<div v-if="context !== ''" class="file-info">
<span>{{ fileType }}</span>
<span>{{ contextSize }}</span>
</div>
<span v-else>{{ fileLoadingText }}</span>
</div> </div>
</div> </div>
</div> </div>
@ -106,11 +109,12 @@
</div> </div>
<div class="right-panel"> <div class="right-panel">
<mavon-editor <mavon-editor
:value="editorContent"
:value="researchContext"
:subfield="true" :subfield="true"
:default-open="'edit,preview'" :default-open="'edit,preview'"
:editable="true" :editable="true"
:ishljs="true" :ishljs="true"
@change="handleEditorChange"
/> />
</div> </div>
</div> </div>
@ -124,8 +128,10 @@ import { form } from '@crud/crud'
import { mapGetters } from 'vuex' import { mapGetters } from 'vuex'
import { FetchDictionaryTree } from '@/api/system/dict' import { FetchDictionaryTree } from '@/api/system/dict'
import { aiEditUpload } from '@/utils/upload' import { aiEditUpload } from '@/utils/upload'
import { FetchEditResearchAI } from '@/api/ai/ai'
// import json from './str.json'
const defaultForm = { id: null, title: null, researchType: null }
const defaultForm = { id: null, researchTitle: null, researchType: null }
export default { export default {
name: 'Form', name: 'Form',
components: { }, components: { },
@ -140,15 +146,16 @@ export default {
formType: 1, formType: 1,
formVisible: false, formVisible: false,
editorRef: 'test', editorRef: 'test',
editorContent: '',
researchContext: '',
options: [], options: [],
rules: { rules: {
title: [{ required: true, trigger: 'blur', message: '专题名称不可为空' }],
researchTitle: [{ required: true, trigger: 'blur', message: '专题名称不可为空' }],
researchType: [{ required: true, trigger: 'change', message: '请选择' }] researchType: [{ required: true, trigger: 'change', message: '请选择' }]
}, },
isCollapsed: false, isCollapsed: false,
inputValue: '', inputValue: '',
file: null,
fileName: '', fileName: '',
fileType: '', fileType: '',
message: [], message: [],
@ -157,10 +164,13 @@ export default {
model: 'deepseek-r1:14b', model: 'deepseek-r1:14b',
messages: [] messages: []
}, },
fileLoadingText: '上传中...',
isUploading: false, isUploading: false,
isAssisting: false,
progress: 0, progress: 0,
animationDuration: 0, animationDuration: 0,
context: ''
context: '',
contextSize: 0
} }
}, },
computed: { computed: {
@ -201,51 +211,100 @@ export default {
this.$message.error('文件大小不能超过 10MB!') this.$message.error('文件大小不能超过 10MB!')
return return
} }
this.fileType = file.type
this.isAssisting = true
this.fileLoadingText = '上传中...'
this.file = file
this.fileName = file.name this.fileName = file.name
this.isUploading = true
this.progress = 0
//
this.fileType = this.fileName.substring(
this.fileName.lastIndexOf('.') + 1,
this.fileName.length
)
// const startTime = Date.now() // const startTime = Date.now()
// const formData = new FormData()
// formData.append('file', file)
try {
aiEditUpload(this.baseApi + '/api/ai/uploadAIResearchFiles',
file,
).then(res => {
console.log('res.data.data', res.data.data)
if (res.data.data !== null) {
this.context = res.data.data.results[0].content
this.$message({ message: '编研附件传输成功', type: 'success', offset: 8 })
} else {
this.$message({ message: '编研附件传输失败', type: 'error', offset: 8 })
}
}).catch(() => {
// this.$message({ message: '', type: 'error', offset: 8 })
})
// const endTime = Date.now()
// const uploadTime = (endTime - startTime) / 1000
// this.animationDuration = uploadTime
// //
// this.$message.success('')
} catch (error) {
//
// this.$message.error('')
} finally {
this.isUploading = false
}
// setTimeout(() => {
// const data = json
// const resultOcr = data.results[0]
// const endTime = Date.now()
// const uploadTime = Math.round((endTime - startTime) / 1000)
// this.animationDuration = uploadTime
// this.isUploading = true
// this.fileLoadingText = '...'
// setTimeout(() => {
// if (resultOcr.status === 'success') {
// this.isUploading = false
// this.isAssisting = false
// //
// this.$message({ message: '', type: 'success', offset: 8 })
// this.context = resultOcr.content
// const length = this.context.length
// if (length >= 10000) {
// this.contextSize = (length / 10000).toFixed(1) + ''
// } else if (length >= 1000) {
// this.contextSize = (length / 1000).toFixed(1) + ''
// } else {
// this.contextSize = length
// }
// } else {
// this.context = ''
// this.$message({ message: ' ', type: 'error', offset: 8 })
// this.isUploading = false
// this.isAssisting = false
// this.fileLoadingText = ''
// }
// }, uploadTime * 1000)
// }, 4000)
const uploadTime = 2
this.animationDuration = uploadTime
setTimeout(() => {
aiEditUpload(this.baseApi + '/api/ai/uploadAIResearchFiles',
file,
).then(res => {
console.log('res.data.data', res.data.data)
if (res.data.data !== null) {
const resultOcr = res.data.data.results[0]
// const endTime = Date.now()
// const uploadTime = Math.round((endTime - startTime) / 1000)
// this.animationDuration = uploadTime
this.animationDuration = 2
this.isUploading = true
this.fileLoadingText = '解析中...'
setTimeout(() => {
if (resultOcr.status === 'success') {
this.isUploading = false
this.isAssisting = false
//
this.$message({ message: '上传的文件已解析完成', type: 'success', offset: 8 })
this.context = resultOcr.content
const length = this.context.length
if (length >= 10000) {
this.contextSize = (length / 10000).toFixed(1) + '万'
} else if (length >= 1000) {
this.contextSize = (length / 1000).toFixed(1) + '千'
} else {
this.contextSize = length
}
} else {
this.context = ''
this.$message({ message: ' 您上传的文件不是纯文本格式,暂不支持解析', type: 'error', offset: 8 })
this.isUploading = false
this.isAssisting = false
this.fileLoadingText = '解析失败'
}
}, this.animationDuration * 1000)
} else {
this.context = ''
this.isUploading = false
this.isAssisting = false
this.fileLoadingText = '上传失败'
this.$message({ message: '编研附件传输失败', type: 'error', offset: 8 })
}
}).catch(() => {
this.context = ''
this.isUploading = false this.isUploading = false
}, uploadTime * 1000)
this.isAssisting = false
this.fileLoadingText = '上传失败'
this.$message({ message: '编研附件传输失败', type: 'error', offset: 8 })
})
} }
}, },
async handleMessage(e) { async handleMessage(e) {
@ -264,11 +323,22 @@ export default {
} }
}, },
async sendMessage(e) { async sendMessage(e) {
if (this.file) {
if (!this.context) {
if (this.fileLoadingText === '解析失败') {
this.$message({ message: '您上传的文件不是纯文本格式,暂不支持解析,请重新选择合适文件!', type: 'error', offset: 8 })
return
} else {
this.$message({ message: '您上传的文件正在解析中,请耐心等待!', type: 'error', offset: 8 })
return
}
}
}
if (!this.inputValue) { if (!this.inputValue) {
this.$message.error('请输入问题')
this.$message({ message: '请输入问题', type: 'error', offset: 8 })
return return
} }
// //
if (this.controller) { if (this.controller) {
this.controller.abort() this.controller.abort()
@ -375,12 +445,16 @@ export default {
} }
}, },
onClickContent(talkContent) { onClickContent(talkContent) {
this.editorContent = ''
this.editorContent = talkContent
this.researchContext = ''
this.researchContext = talkContent
}, },
deleteFile() { deleteFile() {
this.fileName = '' this.fileName = ''
this.fileType = '' this.fileType = ''
this.context = ''
this.file = null
this.isUploading = false
this.isAssisting = false
// input type="file" // input type="file"
if (this.$refs.fileInput) { if (this.$refs.fileInput) {
this.$refs.fileInput.value = '' this.$refs.fileInput.value = ''
@ -388,40 +462,51 @@ export default {
}, },
handleCloseForm() { handleCloseForm() {
this.inputValue = '' this.inputValue = ''
this.editorContent = ''
this.researchContext = ''
this.message = [] this.message = []
this.formVisible = false this.formVisible = false
this.deleteFile()
},
handleEditorChange(value) {
this.researchContext = value
}, },
handleComfiredEditing() { handleComfiredEditing() {
this.$refs.form.validate(valid => { this.$refs.form.validate(valid => {
if (valid) { if (valid) {
console.log('保存数据', this.form) console.log('保存数据', this.form)
this.$confirm('此操作将发布当前编研主题' + '<span>你是否还要继续?</span>', '提示', {
confirmButtonText: '继续',
cancelButtonText: '取消',
type: 'warning',
dangerouslyUseHTMLString: true
}).then(() => {
// const ids = data.map(item => item.id)
// const params = {
// 'ids': ids,
// 'operator': this.user.username
// }
// crudEditing.del(params).then((res) => {
// console.log(res)
// if (res.code !== 500) {
// this.$message({ message: '', type: 'success', offset: 8 })
// } else {
// this.$message({ message: res.message, type: 'error', offset: 8 })
// }
// this.initData()
// }).catch(err => {
// console.log(err)
// })
this.handleCloseForm()
}).catch(() => {
})
console.log('this.researchContext', this.researchContext)
if (this.researchContext === '') {
this.$message({ message: '编研内容不可为空!', type: 'error', offset: 8 })
return
} else {
this.$confirm('此操作将发布当前编研主题' + '<span>你是否还要继续?</span>', '提示', {
confirmButtonText: '继续',
cancelButtonText: '取消',
type: 'warning',
dangerouslyUseHTMLString: true
}).then(() => {
const params = {
'id': this.form.id,
'researchContext': this.researchContext,
'researchTitle': this.form.researchTitle,
'researchType': this.form.researchType
}
console.log('params', params)
FetchEditResearchAI(params).then((res) => {
console.log(res)
if (res) {
this.$message({ message: '编研操作成功', type: 'success', offset: 8 })
this.$emit('initData')
} else {
this.$message({ message: '编研操作失败', type: 'error', offset: 8 })
}
}).catch(err => {
console.log(err)
})
this.handleCloseForm()
}).catch(() => {
})
}
} }
}) })
}, },

103
src/views/AIAssistant/AIIntelligentCoding/index.vue

@ -46,30 +46,31 @@
@selection-change="crud.selectionChangeHandler" @selection-change="crud.selectionChangeHandler"
> >
<el-table-column type="selection" :reserve-selection="true" width="55" align="center" /> <el-table-column type="selection" :reserve-selection="true" width="55" align="center" />
<el-table-column prop="title" label="编研主题" />
<el-table-column prop="researchTitle" label="编研主题" />
<el-table-column prop="researchType" label="编研类型" align="center" /> <el-table-column prop="researchType" label="编研类型" align="center" />
<el-table-column prop="editor1" label="主编人" align="center" />
<el-table-column prop="startTime" label="创建时间" width="200">
<el-table-column prop="update_by" label="主编人" align="center" />
<el-table-column prop="create_time" label="创建时间" width="200">
<template slot-scope="scope"> <template slot-scope="scope">
<div>{{ scope.row.startTime | parseTime }}</div>
<div>{{ scope.row.create_time | parseTime }}</div>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="startTime" label="最后更新时间" width="200">
<el-table-column prop="update_time" label="最后更新时间" width="200">
<template slot-scope="scope"> <template slot-scope="scope">
<div>{{ scope.row.startTime | parseTime }}</div>
<div>{{ scope.row.update_time | parseTime }}</div>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
<pagination v-if="crud.data.length !== 0" /> <pagination v-if="crud.data.length !== 0" />
<aiForm ref="aiForm" />
<aiForm ref="aiForm" @initData="initData" />
<el-dialog class="detail-dialog ai-detial-dialog" title="编研详情" :close-on-click-modal="false" :modal-append-to-body="false" append-to-body :visible.sync="onlineEditDetail" :before-close="handleCloseDialog"> <el-dialog class="detail-dialog ai-detial-dialog" title="编研详情" :close-on-click-modal="false" :modal-append-to-body="false" append-to-body :visible.sync="onlineEditDetail" :before-close="handleCloseDialog">
<div class="setting-dialog"> <div class="setting-dialog">
<div style="width: 100%; height: 500px; overflow: hidden; overflow-y: scroll;">
<!-- overflow-y: scroll; -->
<div style="width: 100%; height: 500px; overflow: hidden; ">
<div style="margin: 20px; line-height: 30px;"> <div style="margin: 20px; line-height: 30px;">
<p>专题名称{{ onlineContent && onlineContent.title }}</p>
<p>编研类型{{ onlineContent && onlineContent.type }}</p>
<p>专题名称{{ currentResearch && currentResearch.researchTitle }}</p>
<p>编研类型{{ currentResearch && currentResearch.researchType }}</p>
</div> </div>
<mavon-editor <mavon-editor
class="md" class="md"
@ -128,15 +129,9 @@ export default {
del: ['admin', 'archiveEditing:del'] del: ['admin', 'archiveEditing:del']
}, },
keyWord: null, keyWord: null,
blurryTime: null,
participants: false,
currentResearch: null, currentResearch: null,
onlineEditDetail: false, onlineEditDetail: false,
onlineTabIndex: 0,
onlineContent: null, onlineContent: null,
uploadVisible: false,
fileList: [],
detailArcData: [],
currentResearchOnline: null currentResearchOnline: null
} }
}, },
@ -154,62 +149,24 @@ export default {
this.$refs.table.clearSelection() this.$refs.table.clearSelection()
}, },
resetQuery() { resetQuery() {
this.blurryTime = []
this.crud.query.startTime = null
this.crud.query.endTime = null
this.keyWord = ''
this.crud.query.search = ''
this.crud.toQuery() this.crud.toQuery()
}, },
[CRUD.HOOK.beforeRefresh]() { [CRUD.HOOK.beforeRefresh]() {
this.crud.query.search = this.keyWord this.crud.query.search = this.keyWord
if (this.participants) {
this.crud.query.participants = this.user.username
} else {
this.crud.query.participants = ''
}
if (this.blurryTime) {
this.crud.query.startTime = this.blurryTime[0]
this.crud.query.endTime = this.blurryTime[1]
} else {
this.crud.query.startTime = null
this.crud.query.endTime = null
}
}, },
toAdd(type, row) { toAdd(type, row) {
if (type === 1) { if (type === 1) {
this.$refs.aiForm.formTitle = '新增AI编研' this.$refs.aiForm.formTitle = '新增AI编研'
} else { } else {
this.$refs.aiForm.formTitle = '编辑AI编研' this.$refs.aiForm.formTitle = '编辑AI编研'
// this.$refs.aiForm.form = {
// 'id': row.id,
// 'title': row.title,
// 'editor1': row.editor1,
// 'editor2': row.editor2,
// 'researchType': row.researchType,
// 'startTime': row.startTime,
// 'endTime': row.endTime,
// 'remarks': row.remarks
// }
// if (row.editor1) {
// var usernames = row.editor1.split(',')
// var matchedItems = []
// for (var i = 0; i < this.$refs.aiForm.userTable.length; i++) {
// if (usernames.includes(this.$refs.aiForm.userTable[i].username)) {
// matchedItems.push(this.$refs.aiForm.userTable[i])
// }
// }
// this.$refs.aiForm.userMainSelected = matchedItems
// }
// if (row.editor2) {
// var usernames2 = row.editor2.split(',')
// var matchedItems2 = []
// for (var j = 0; j < this.$refs.aiForm.userTable.length; j++) {
// if (usernames2.includes(this.$refs.aiForm.userTable[j].username)) {
// matchedItems2.push(this.$refs.aiForm.userTable[j])
// }
// }
// this.$refs.aiForm.userOtherSelected = matchedItems2
// }
this.$refs.aiForm.form = {
'id': row.id,
'researchTitle': row.researchTitle,
'researchType': row.researchType
}
this.$refs.aiForm.researchContext = row.researchContext
} }
this.$refs.aiForm.formType = type this.$refs.aiForm.formType = type
this.$refs.aiForm.formVisible = true this.$refs.aiForm.formVisible = true
@ -244,18 +201,9 @@ export default {
this.$refs.table.toggleRowSelection(row) this.$refs.table.toggleRowSelection(row)
}, },
tableDoubleClick(row) { tableDoubleClick(row) {
this.currentResearchOnline = row
this.currentResearch = row
this.onlineEditDetail = true this.onlineEditDetail = true
this.onlineContent = ''
// const params = {
// 'researchOnlineId': row.id
// }
// FetchInitResearchOnlineDetails(params).then((res) => {
// console.log(res)
// this.onlineContent = res
// }).catch(err => {
// console.log(err)
// })
this.onlineContent = row.researchContext
}, },
handleCloseDialog(done) { handleCloseDialog(done) {
this.onlineEditDetail = false this.onlineEditDetail = false
@ -265,8 +213,11 @@ export default {
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
::v-deep .v-note-wrapper{
width: 100% !important;
min-height: auto !important;
.ai-detial-dialog{
::v-deep .v-note-wrapper{
width: 100% !important;
min-height: 500px !important;
}
} }
</style> </style>

20
src/views/AIAssistant/AIIntelligentCoding/str.json
File diff suppressed because it is too large
View File

2
src/views/archiveUtilize/archiveEditing/module/materialSelected.vue

@ -3,7 +3,7 @@
<el-dialog class="collectMoveFile-dialog" title="素材选择" :close-on-click-modal="false" :modal-append-to-body="false" append-to-body :visible.sync="materialFileVisible" :before-close="handleCloseDialog" @open="open"> <el-dialog class="collectMoveFile-dialog" title="素材选择" :close-on-click-modal="false" :modal-append-to-body="false" append-to-body :visible.sync="materialFileVisible" :before-close="handleCloseDialog" @open="open">
<div class="collectMove-main"> <div class="collectMove-main">
<div class="collectMove-left"> <div class="collectMove-left">
<CategoryTree ref="categoryTree" @nodeClick="handleNodeClick" />
<CategoryTree ref="categoryTree" is-move-file="false" @nodeClick="handleNodeClick" />
</div> </div>
<div class="collectMove-right"> <div class="collectMove-right">
<div class="collectMove-header"> <div class="collectMove-header">

4
src/views/collectReorganizi/batchConnection/index.vue

@ -1,8 +1,8 @@
<template> <template>
<div class="app-container archives-container"> <div class="app-container archives-container">
<div class="container-main" style="justify-content: flex-start;"> <div class="container-main" style="justify-content: flex-start;">
<CategoryTree ref="categoryTree" @nodeClick="handleNodeClick" />
<div v-if="currentCategory && currentCategory.isType !== 1" class="elect-cont-right">
<CategoryTree ref="categoryTree" is-move-file="false" @nodeClick="handleNodeClick" />
<div v-if="currentCategory && currentCategory.isType === 2" class="elect-cont-right">
<div class="connection-header collect-header"> <div class="connection-header collect-header">
<h4 class="is-anjuan">{{ currentCategory && currentCategory.cnName }} </h4> <h4 class="is-anjuan">{{ currentCategory && currentCategory.cnName }} </h4>
<div class="head-search"> <div class="head-search">

1
src/views/collectReorganizi/collectionLibrary/mixins/index.js

@ -230,7 +230,6 @@ export const collectionLibraryCrud = {
this.$parent.$parent.$emit('myYearEvent', this.yearData) this.$parent.$parent.$emit('myYearEvent', this.yearData)
} }
if (type === 'search') { if (type === 'search') {
console.log('wjObj', wjObj)
// wjObj.anjuanData = res.list.content // wjObj.anjuanData = res.list.content
wjObj.anjuanData = res.list.content.map(item => { wjObj.anjuanData = res.list.content.map(item => {
return { return {

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

@ -95,7 +95,7 @@
<el-menu-item v-if="isTitleType === 3 && activeIndex === 0 && selectedCategory.arrangeType !== 1" index="2-7" @click="handleCombineFile">合卷</el-menu-item> <el-menu-item v-if="isTitleType === 3 && activeIndex === 0 && selectedCategory.arrangeType !== 1" index="2-7" @click="handleCombineFile">合卷</el-menu-item>
<el-menu-item v-if="isTitleType === 3 && selectedCategory.arrangeType !== 1" index="2-8" @click="handleInsertFile">插件</el-menu-item> <el-menu-item v-if="isTitleType === 3 && selectedCategory.arrangeType !== 1" index="2-8" @click="handleInsertFile">插件</el-menu-item>
<!-- 案卷 / 卷内 / 文件 --> <!-- 案卷 / 卷内 / 文件 -->
<el-menu-item v-if="isTitleType !== 2" index="2-9" @click="handleCollectMoveFile">移动</el-menu-item>
<el-menu-item v-if="(isTitleType === 3 && selectedCategory.arrangeType === 1) || (isTitleType === 3 && activeIndex === 1) || (isTitleType === 4 ) " index="2-9" @click="handleCollectMoveFile">移动</el-menu-item>
<!-- 案卷 --> <!-- 案卷 -->
<el-menu-item v-if="isTitleType === 3 && activeIndex === 0" index="2-10" @click="handleFiling">归档</el-menu-item> <el-menu-item v-if="isTitleType === 3 && activeIndex === 0" index="2-10" @click="handleFiling">归档</el-menu-item>
<!-- 文件 --> <!-- 文件 -->
@ -1066,7 +1066,60 @@ export default {
this.$message({ message: '您所选的条目有正在归档流程中,不可操作移动,请先确认!', offset: 8 }) this.$message({ message: '您所选的条目有正在归档流程中,不可操作移动,请先确认!', offset: 8 })
return false return false
} }
this.$refs.collectMoveFileRef.collectMoveFileVisible = true
// if (this.isTitleType === 2) {
// this.$refs.collectMoveFileRef.parentsId = null
// } else if (this.isTitleType === 3) {
// if (this.selectedCategory.arrangeType === 1) {
// this.$refs.collectMoveFileRef.parentsId = null
// } else {
// if (this.activeIndex === 1) {
// this.$refs.collectMoveFileRef.parentsId = null
// } else {
// this.$refs.collectMoveFileRef.parentsId = this.parentsData.parentsProjectId
// }
// }
// } else if (this.isTitleType === 4) {
// this.$refs.collectMoveFileRef.parentsId = this.parentsData.parentsAnjuanId
// } else if (this.isTitleType === 6) {
// if (this.selectedCategory.arrangeType === 1) {
// this.$refs.collectMoveFileRef.parentsId = this.parentsData.parentsAnjuanId
// } else {
// if (this.parentsData.isTabFile) {
// this.$refs.collectMoveFileRef.parentsId = this.parentsData.parentsAnjuanId
// } else {
// this.$refs.collectMoveFileRef.parentsId = this.parentsData.parentsJuanneiId
// }
// }
// }
this.$nextTick(() => {
this.$refs.collectMoveFileRef.collectMoveFileVisible = true
if (!this.isTitleType) {
// isTitleType null
this.setParentsId(this.$refs, null)
} else if (this.isTitleType === 2 ||
(this.isTitleType === 3 && this.selectedCategory.arrangeType === 1) ||
(this.isTitleType === 3 && this.activeIndex === 1)) {
// null
this.setParentsId(this.$refs, null)
} else if (this.isTitleType === 3) {
this.setParentsId(this.$refs, this.parentsData?.parentsProjectId ?? null)
} else if (this.isTitleType === 4) {
this.setParentsId(this.$refs, this.parentsData?.parentsAnjuanId ?? null)
} else if (this.isTitleType === 6) {
if (this.selectedCategory.arrangeType === 1 || this.parentsData.isTabFile) {
this.setParentsId(this.$refs, this.parentsData?.parentsAnjuanId ?? null)
} else {
this.setParentsId(this.$refs, this.parentsData?.parentsJuanneiId ?? null)
}
}
})
},
setParentsId(safeRef, value) {
if (safeRef && safeRef.collectMoveFileRef) {
safeRef.collectMoveFileRef.parentsId = value
} else {
console.warn('collectMoveFileRef is not available')
}
}, },
// //
handleFiling() { handleFiling() {

150
src/views/collectReorganizi/collectionLibrary/module/collectMoveFile/index.vue

@ -3,17 +3,17 @@
<el-dialog class="collectMoveFile-dialog" title="移动" :close-on-click-modal="false" :modal-append-to-body="false" append-to-body :visible.sync="collectMoveFileVisible" :before-close="handleCloseDialog" @open="open"> <el-dialog class="collectMoveFile-dialog" title="移动" :close-on-click-modal="false" :modal-append-to-body="false" append-to-body :visible.sync="collectMoveFileVisible" :before-close="handleCloseDialog" @open="open">
<div class="collectMove-main"> <div class="collectMove-main">
<div class="collectMove-left"> <div class="collectMove-left">
<CategoryTree ref="categoryTree" @nodeClick="handleNodeClick" />
<CategoryTree ref="categoryTree" is-move-file="true" @nodeClick="handleNodeClick" />
</div> </div>
<div class="collectMove-right">
<div v-if="currentCategory && currentCategory.isType===2" class="collectMove-right">
<div class="collectMove-header"> <div class="collectMove-header">
<div v-if="currentCategory && currentCategory.arrangeType===3" class="detail-tab tab-content">
<!-- <div v-if="currentCategory && currentCategory.arrangeType===3" class="detail-tab tab-content">
<ul class="tab-nav"> <ul class="tab-nav">
<li :class="{'active-tab-nav': tabIndex == 0}" @click="changeActiveTab(0)">项目列表</li> <li :class="{'active-tab-nav': tabIndex == 0}" @click="changeActiveTab(0)">项目列表</li>
<li :class="{'active-tab-nav': tabIndex == 1}" @click="changeActiveTab(1)">案卷列表</li> <li :class="{'active-tab-nav': tabIndex == 1}" @click="changeActiveTab(1)">案卷列表</li>
</ul> </ul>
</div>
</div> -->
<div class="head-search"> <div class="head-search">
<el-input v-model="query.search" clearable size="small" placeholder="输入题名或档号搜索" prefix-icon="el-icon-search" style="width: 200px;" class="filter-item" @keyup.enter.native="getViewTableList" @clear="getViewTableList" /> <el-input v-model="query.search" clearable size="small" placeholder="输入题名或档号搜索" prefix-icon="el-icon-search" style="width: 200px;" class="filter-item" @keyup.enter.native="getViewTableList" @clear="getViewTableList" />
<el-button class="filter-item filter-search" style="margin: 0 10px;" size="mini" type="success" icon="el-icon-search" @click="getViewTableList">搜索</el-button> <el-button class="filter-item filter-search" style="margin: 0 10px;" size="mini" type="success" icon="el-icon-search" @click="getViewTableList">搜索</el-button>
@ -77,7 +77,8 @@
</div> </div>
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer">
<el-button type="text" @click="handleCloseDialog">取消</el-button> <el-button type="text" @click="handleCloseDialog">取消</el-button>
<el-button :loading="btnLoading" type="primary" :disabled="currentCategory&&currentCategory.arrangeType===3&&moveSelections.length===0&&collectLevel===2 " @click.native="handleComfireCollectMoveFile">确定</el-button>
<!-- :disabled="currentCategory&&currentCategory.arrangeType===3&&moveSelections.length===0&&collectLevel===2 " -->
<el-button :loading="btnLoading" type="primary" @click.native="handleComfireCollectMoveFile">确定</el-button>
</div> </div>
</el-dialog> </el-dialog>
</template> </template>
@ -128,7 +129,8 @@ export default {
}, },
moveFile: true, moveFile: true,
isReserve: false, isReserve: false,
tabIndex: 0
tabIndex: 0,
parentsId: null
} }
}, },
mounted() { mounted() {
@ -165,11 +167,12 @@ export default {
} else if (this.currentCategory.arrangeType === 2) { } else if (this.currentCategory.arrangeType === 2) {
this.currentLevel = 2 this.currentLevel = 2
} else { } else {
if (this.tabIndex === 1) {
this.currentLevel = 2
} else {
this.currentLevel = 1
}
this.currentLevel = 2
// if (this.tabIndex === 1) {
// this.currentLevel = 2
// } else {
// this.currentLevel = 1
// }
} }
FetchInitCategoryViewTable({ categoryId: this.currentCategory.id, categoryLevel: this.currentLevel }).then((res) => { FetchInitCategoryViewTable({ categoryId: this.currentCategory.id, categoryLevel: this.currentLevel }).then((res) => {
if (res) { if (res) {
@ -195,12 +198,13 @@ export default {
'categoryId': this.currentCategory.id, 'categoryId': this.currentCategory.id,
'categoryLevel': this.currentLevel, 'categoryLevel': this.currentLevel,
'ignore': false, 'ignore': false,
'isdel': false,
'fonds_no': this.currentCategory.fondsId,
'search': this.query.search, 'search': this.query.search,
'page': this.page.page - 1, 'page': this.page.page - 1,
'size': this.page.size 'size': this.page.size
} }
FetchInitCategoryView(params).then((res) => { FetchInitCategoryView(params).then((res) => {
console.log(res)
if (res.code !== 500) { if (res.code !== 500) {
this.tableData = res.list.content this.tableData = res.list.content
this.page.total = res.list.totalElements this.page.total = res.list.totalElements
@ -223,20 +227,29 @@ export default {
this.moveSelections = selection this.moveSelections = selection
}, },
handleComfireCollectMoveFile() { handleComfireCollectMoveFile() {
const archivesIds = this.selections.map(item => item.id)
if (this.moveSelections.length > 1) { if (this.moveSelections.length > 1) {
this.$message({ message: '该操作只可勾选唯一目标条目,请先确认!', offset: 8 }) this.$message({ message: '该操作只可勾选唯一目标条目,请先确认!', offset: 8 })
return false return false
} }
if (this.currentCategory.arrangeType === 1) { if (this.currentCategory.arrangeType === 1) {
//
this.toCategoryLevel = 3 this.toCategoryLevel = 3
} else if (this.currentCategory.arrangeType === 2) { } else if (this.currentCategory.arrangeType === 2) {
//
this.toCategoryLevel = 2 this.toCategoryLevel = 2
} else { } else {
console.log(this.collectLevel)
//
//
console.log('this.collectLevel', this.collectLevel)
if (this.collectLevel === 3) { if (this.collectLevel === 3) {
//
//
if (this.moveSelections.length === 0) { if (this.moveSelections.length === 0) {
this.toCategoryLevel = 3 this.toCategoryLevel = 3
} else { } else {
// tab
if (this.tabIndex === 1) { if (this.tabIndex === 1) {
this.toCategoryLevel = 2 this.toCategoryLevel = 2
} else { } else {
@ -244,6 +257,7 @@ export default {
} }
} }
} else { } else {
//
if (this.tabIndex === 1) { if (this.tabIndex === 1) {
this.toCategoryLevel = 2 this.toCategoryLevel = 2
} else { } else {
@ -251,37 +265,109 @@ export default {
} }
} }
} }
if (this.collectLevel === 2) { if (this.collectLevel === 2) {
if (this.toCategoryLevel === 3) { if (this.toCategoryLevel === 3) {
this.$message({ message: '案卷级的案卷不可移动到文件级,请先确认!', offset: 8 })
this.$message({ message: '案卷不可移动到文件级,请先确认!', offset: 8 })
return false return false
} }
} }
if (this.selectedCategory.id === this.currentCategory.id) {
this.$message({ message: '正在移动的档案只可移动到其他位置,不可选择本身!', offset: 8 })
return false
console.log('parentsId', this.parentsId)
console.log('this.currentCategory', this.currentCategory)
console.log('this.collectLevel', this.collectLevel)
console.log('this.toCategoryLevel', this.toCategoryLevel)
if (this.collectLevel === this.toCategoryLevel) {
if (this.moveSelections.length === 0) {
if (this.currentCategory.arrangeType !== 1) {
this.$message({ message: '请选择一个案卷条目进行移动操作!', offset: 8 })
return false
} else {
if (this.selectedCategory.id === this.currentCategory.id) {
this.$message({ message: '正在移动的档案不操作移动到自身同门类下!', offset: 8 })
return false
}
}
} else {
if (this.currentCategory.arrangeType === 1) {
this.$message({ message: '不可选择文件条目进行移动!', offset: 8 })
return false
}
if (this.parentsId === this.moveSelections[0].id) {
this.$message({ message: '正在移动的档案不操作移动到自身档案下!', offset: 8 })
return false
}
// const targetId = this.moveSelections[0].id
// const isExists = archivesIds.includes(targetId)
// if (isExists) {
// this.$message({ message: '!', offset: 8 })
// return false
// }
}
} else {
if (this.moveSelections.length === 0) {
if (this.currentCategory.arrangeType === 2) {
this.$message({ message: '请选择一个案卷条目进行移动操作!', offset: 8 })
return false
}
} else {
if (this.currentCategory.arrangeType === 1) {
this.$message({ message: '不可选择文件条目进行移动!', offset: 8 })
return false
}
}
} }
const archivesIds = this.selections.map(item => item.id)
// if (this.collectLevel === 3 && this.toCategoryLevel === 2) {
// if (this.moveSelections.length !== 0) {
// if (this.parentsId === this.moveSelections[0].id) {
// this.$message({ message: '!', offset: 8 })
// return false
// }
// }
// }
console.log('this.toCategoryLevel', this.toCategoryLevel)
// if (this.currentCategory.arrangeType === 3 && this.collectLevel === 2) {
// if (this.moveSelections.length === 0) {
// this.$message({ message: '!', offset: 8 })
// return false
// }
// }
// if (this.currentCategory.arrangeType === 3 && this.collectLevel === 3) {
// if (this.moveSelections.length === 0) {
// this.$message({ message: '!', offset: 8 })
// return false
// }
// }
console.log('this.selections', this.selections)
console.log('this.moveSelections', this.moveSelections)
// const toArchivesIds = this.moveSelections.map(item => item.id) // const toArchivesIds = this.moveSelections.map(item => item.id)
let toArchivesId let toArchivesId
if (this.moveSelections.length === 0) { if (this.moveSelections.length === 0) {
toArchivesId = null toArchivesId = null
} else { } else {
if (this.collectLevel === 3) {
if (this.tabIndex === 1) {
toArchivesId = this.moveSelections[0].id
} else {
if (this.selectedCategory.arrangeType === 1) {
toArchivesId = this.moveSelections[0].id
} else {
toArchivesId = null
}
}
} else {
toArchivesId = this.moveSelections[0].id
}
toArchivesId = this.moveSelections[0].id
// if (this.collectLevel === 3) {
// if (this.tabIndex === 1) {
// toArchivesId = this.moveSelections[0].id
// } else {
// if (this.selectedCategory.arrangeType === 1) {
// toArchivesId = this.moveSelections[0].id
// } else {
// toArchivesId = null
// }
// }
// } else {
// toArchivesId = this.moveSelections[0].id
// }
} }
this.btnLoading = true
// this.btnLoading = true
const params = { const params = {
'reserve': this.isReserve, // true false 'reserve': this.isReserve, // true false
'categoryId': this.selectedCategory.id, // id 'categoryId': this.selectedCategory.id, // id

205
src/views/components/categoryTree.vue

@ -6,17 +6,22 @@
<div class="arc-left-tree"> <div class="arc-left-tree">
<h3 class="arc-title arc-title-top">档案门类</h3> <h3 class="arc-title arc-title-top">档案门类</h3>
<div class="tree-scroll"> <div class="tree-scroll">
<el-tree ref="tree" v-loading="loading" class="arc-tree" :data="categroyTree" :props="defaultProps" node-key="id" :expand-on-click-node="false" highlight-current @node-click="handleNodeClick">
<el-tree ref="categroyTree" v-loading="loading" class="arc-tree" :data="categroyTree" :props="defaultProps" node-key="id" :expand-on-click-node="false" default-expand-all highlight-current @node-click="handleNodeClick">
<span slot-scope="{ node, data }" class="custom-tree-node"> <span slot-scope="{ node, data }" class="custom-tree-node">
<span v-if="data.isType === 1 " class="iconFolder">
{{ data.cnName }}
</span>
<span v-if="data.isType === 2" class="iconArch">
{{ data.cnName }}
</span>
<span v-if="data.isType === 3" class="iconFile">
{{ data.cnName }}
</span>
<el-tooltip :content="node.label" placement="left" :enterable="false" effect="dark">
<span v-if="data.isType === 0">
{{ data.label }}
</span>
<span v-if="data.isType === 1" class="iconFolder tree-text">
{{ data.label }}
</span>
<span v-if="data.isType === 2" class="iconArch tree-text">
{{ data.label }}
</span>
<span v-if="data.isType === 3" class="iconFile tree-text">
{{ data.label }}
</span>
</el-tooltip>
</span> </span>
</el-tree> </el-tree>
</div> </div>
@ -26,20 +31,33 @@
</template> </template>
<script> <script>
import { FetchCategoryMenu } from '@/api/system/category/category'
import { getfondMenu } from '@/api/category/category'
import { mapGetters } from 'vuex'
export default { export default {
name: 'CategoryTree', name: 'CategoryTree',
props: {
isMoveFile: {
type: String,
default: 'false'
}
},
data() { data() {
return { return {
categroyTree: [], categroyTree: [],
loading: false, loading: false,
defaultProps: { defaultProps: {
children: 'children', children: 'children',
label: 'cnName'
label: 'label'
}, },
selectedCategory: {} selectedCategory: {}
} }
}, },
computed: {
...mapGetters([
'baseApi',
'user'
])
},
watch: { watch: {
}, },
created() { created() {
@ -48,6 +66,67 @@ export default {
mounted() { mounted() {
}, },
methods: { methods: {
getCateTree() {
this.loading = true
getfondMenu().then(res => {
this.categroyTree = this.filterData(this.transformData(res))
console.log('this.categroyTree', this.categroyTree)
console.log('this.user', this.user.fonds.id)
// fondsId
console.log('this.isMoveFile', this.isMoveFile)
if (this.isMoveFile === 'true') {
const targetFondsId = this.user.fonds.id
this.categroyTree = this.categroyTree.filter(item => {
if (item.id === targetFondsId) {
return true
}
if (item.children) {
item.children = item.children.filter(child => {
if (child.fondsId === targetFondsId) {
if (child.children) {
child.children = child.children.filter(grandChild => grandChild.fondsId === targetFondsId)
}
return true
}
return false
})
return item.children.length > 0
}
return false
})
}
this.$nextTick(() => {
let currentKey
if (this.categroyTree[0].isType === 0) {
currentKey = this.findNode(this.categroyTree[0].children, (node) => {
return node.isType !== 1
})
} else {
currentKey = this.categroyTree[0]
}
if (currentKey.id) {
//
this.$refs.categroyTree.setCurrentKey(currentKey.id)
this.$nextTick(() => {
//
const selectedKey = this.$refs.categroyTree.getCurrentNode()
if (this.$refs.categroyTree.getNode(selectedKey) && this.$refs.categroyTree.getNode(selectedKey).parent) {
this.expandParents(this.$refs.categroyTree.getNode(selectedKey).parent)
}
//
this.handleNodeClick(selectedKey)
})
}
})
this.loading = false
})
},
handleNodeClick(val) {
this.selectedCategory = val
this.$emit('nodeClick', val)
},
filterData(data) { filterData(data) {
return data.filter(node => { return data.filter(node => {
if (node.children && node.children.length > 0) { if (node.children && node.children.length > 0) {
@ -67,47 +146,85 @@ export default {
} }
return null return null
}, },
//
expandParents(node) { expandParents(node) {
node.expanded = true node.expanded = true
if (node.parent) { if (node.parent) {
this.expandParents(node.parent) this.expandParents(node.parent)
} }
}, },
getCateTree() {
this.loading = true
FetchCategoryMenu().then(res => {
this.categroyTree = this.filterData(res)
this.$nextTick(() => {
let currentKey
if (this.categroyTree[0].isType === 1) {
currentKey = this.findNode(this.categroyTree[0].children, (node) => {
return node.isType !== 1
})
} else {
currentKey = this.categroyTree[0]
}
if (currentKey.id) {
//
this.$refs.tree.setCurrentKey(currentKey.id)
this.$nextTick(() => {
//
const selectedKey = this.$refs.tree.getCurrentNode()
if (this.$refs.tree.getNode(selectedKey) && this.$refs.tree.getNode(selectedKey).parent) {
this.expandParents(this.$refs.tree.getNode(selectedKey).parent)
}
//
this.handleNodeClick(selectedKey)
})
//
expandAllChildren(node, targetElement) {
node.expanded = true
//
if (node.childNodes && node.childNodes.length > 0) {
for (let i = 0; i < node.childNodes.length; i++) {
if (node.childNodes[i].data.id === targetElement.id) {
this.$refs.categroyTree.setCurrentKey(node.childNodes[i])
} }
})
this.loading = false
this.expandAllChildren(node.childNodes[i], targetElement)
}
}
},
// el-tree
transformData(rawData) {
return rawData.map(item => {
return {
label: item.fondName,
isType: 0,
id: item.fondsId,
fondsNo: item.fondsNo,
children: item.categoryList.map(category => {
return {
label: category.cnName,
cnName: category.cnName,
id: category.id,
arrangeType: category.arrangeType,
isType: category.isType,
fondsId: item.fondsId,
fondName: item.fondName,
fondsNo: item.fondsNo,
children: this.transformChildren(category.children, item.fondsId, item.fondName, item.fondsNo)
}
})
}
}) })
}, },
handleNodeClick(val) {
this.selectedCategory = val
if (val.cnName) {
this.$emit('nodeClick', val)
//
transformChildren(children, fondsId, fondName, fondsNo) {
return children.map(child => {
return {
label: child.cnName,
cnName: child.cnName,
id: child.id,
isType: child.isType,
pid: child.pid,
code: child.code,
arrangeType: child.arrangeType,
fondsId: fondsId,
fondName: fondName,
fondsNo: fondsNo,
children: child.children.length ? this.transformChildren(child.children, fondsId, fondName, fondsNo) : []
}
})
},
//
findTopLevelNode(data, fondsId) {
for (let i = 0; i < data.length; i++) {
if (data[i].id === fondsId) {
return data[i]
}
}
return null
},
defaultSetting(currentKey) {
if (this.crud.data[0].isType === 0) {
currentKey = this.findNode(this.crud.data[0].children, (node) => {
return node.isType !== 1
})
this.expandAllChildren(this.$refs.categroyTree.getNode(this.crud.data[0]), currentKey)
} else {
currentKey = this.crud.data[0]
this.expandAllChildren(this.$refs.categroyTree.getNode(this.crud.data[0]), currentKey)
} }
} }
} }

36
src/views/components/echarts/graph.vue

@ -20,7 +20,8 @@
</template> </template>
<template #graph-plug> <template #graph-plug>
<div v-if="isShowNodeTipsPanel" :style="{left: nodeMenuPanelPosition.x + 'px', top: nodeMenuPanelPosition.y + 'px' }" style="z-index: 999;padding:10px;background-color: #ffffff;border:#eeeeee solid 1px;box-shadow: 0px 0px 8px #cccccc;position: absolute;"> <div v-if="isShowNodeTipsPanel" :style="{left: nodeMenuPanelPosition.x + 'px', top: nodeMenuPanelPosition.y + 'px' }" style="z-index: 999;padding:10px;background-color: #ffffff;border:#eeeeee solid 1px;box-shadow: 0px 0px 8px #cccccc;position: absolute;">
<div style="line-height: 25px;padding-left: 10px;color: #888888;font-size: 12px;">节点名称{{ currentNode.text }}</div>
<div style="line-height: 25px;color: #888888;font-size: 12px;">节点类型{{ currentNode.typeText }}</div>
<div style="line-height: 25px;color: #888888;font-size: 12px;">节点名称{{ currentNode.text }}</div>
</div> </div>
</template> </template>
</RelationGraph> </RelationGraph>
@ -117,9 +118,25 @@ export default {
}, },
setData(data, selectedNodeId = null) { setData(data, selectedNodeId = null) {
const { nodes, lines } = data const { nodes, lines } = data
// ArchivesCategoryCategoryClassFondsKeywordsRetentionSecrecyPeriodSecurityClass
// ArchivesCategoryCategoryClassFondsKeywordsRetentionSecrecyPeriodSecurityClass
const typeToTextMap = {
Archives: '档案',
Category: '档案门类',
CategoryClass: '档案分类',
Fonds: '全宗',
Keywords: '关键词',
Retention: '保管期限',
SecrecyPeriod: '保密期限',
SecurityClass: '密级'
}
const newNodes = nodes.map(item => { const newNodes = nodes.map(item => {
const newItem = { ...item, id: String(item.id), originId: item.properties.id, text: item.properties.title, type: item.labels[0] }
const newItem = {
...item,
id: String(item.id),
originId: item.properties.id,
text: item.properties.title,
type: item.labels[0]
}
const typeToColorMap = { const typeToColorMap = {
Archives: '#0348F3', Archives: '#0348F3',
Category: '#14C9C9', Category: '#14C9C9',
@ -139,6 +156,9 @@ export default {
newItem.color = defaultColor newItem.color = defaultColor
newItem.borderColor = defaultColor newItem.borderColor = defaultColor
} }
// type newItem typeText
newItem.typeText = typeToTextMap[newItem.type]
return newItem return newItem
}) })
@ -249,6 +269,16 @@ export default {
}, },
showNodeTips(nodeObject, $event) { showNodeTips(nodeObject, $event) {
this.currentNode = nodeObject this.currentNode = nodeObject
const nodeId = nodeObject.id
const targetNode = this.allData.nodes.find(node => node.id === nodeId)
if (!targetNode) {
console.error(`未找到 ID 为 ${nodeId} 的节点`)
return
}
this.currentNode.typeText = targetNode.typeText
const _base_position = this.$refs.graphRef.getInstance().options.fullscreen ? { x: 0, y: 0 } : this.$refs.myPage.getBoundingClientRect() const _base_position = this.$refs.graphRef.getInstance().options.fullscreen ? { x: 0, y: 0 } : this.$refs.myPage.getBoundingClientRect()
this.isShowNodeTipsPanel = true this.isShowNodeTipsPanel = true
this.nodeMenuPanelPosition.x = $event.clientX - _base_position.x + 10 this.nodeMenuPanelPosition.x = $event.clientX - _base_position.x + 10

Loading…
Cancel
Save