diff --git a/kcui/src/view/Graph.vue b/kcui/src/view/Graph.vue
index 703df7d..bef480d 100644
--- a/kcui/src/view/Graph.vue
+++ b/kcui/src/view/Graph.vue
@@ -2,6 +2,12 @@
@@ -46,7 +66,7 @@ import {getgraphInfo, test} from "@/api/login";
import VisGraph from '@/assets/js/graphvis.min.20241008.js'
import LayoutFactory from '@/assets/js/graphvis.layout.min.js'
import {config} from '@/assets/defaultConfig.js'
-import {addNode} from "@/api/file";
+import {addNode, getFileIdByDocId} from "@/api/file";
export default {
// eslint-disable-next-line vue/multi-word-component-names
@@ -69,8 +89,9 @@ export default {
newBranchFileId: '',
newBranchLevel: null,
newBranchParentId: '',
- newBranchRelation:''
-
+ newBranchRelation:'',
+ typeValue: '',
+ keywords: '',
}
},
methods:{
@@ -80,12 +101,34 @@ export default {
onCreated(editor) {
this.editor = Object.seal(editor) // 一定要用 Object.seal() ,否则会报错
},
- getInfo(){
- var data = {}
- getgraphInfo(data).then((res)=>{
- this.zhengl(res.data);
+ // getInfo(){
+ // var data = {}
+ // getgraphInfo(data).then((res)=>{
+ // this.zhengl(res.data);
+ //
+ // })
+ // },
+ getInfo() {
+
+ this.data = undefined;
+ if (this.keywords != '' && this.keywords != undefined) {
+ this.visGraph.clearAll();
+ let params = {
+ nodename: this.keywords,
+ };
+ getgraphInfo(params).then((res) => {
+ this.zhengl(res.data);
+ })
+ } else {
+
+ let params = {};
+
+ getgraphInfo(params).then((res) => {
+ this.zhengl(res.data);
+ })
+ }
+
- })
},
async drawGraphData() {
this.graphData = this.demoData;
@@ -122,14 +165,27 @@ export default {
};
this.visGraph = new VisGraph(document.getElementById('graph-panel'), configWithEvents);
},
- showPopup(node) {
+ async showPopup(node) {
console.log("o----------")
console.log(node)
this.selectedNode = node;
this.newBranchParentId = node.properties.docId;
this.newBranchLevel = parseInt(node.properties.level) + 1;
+
+ try {
+ const response = await this.getFileIdByDocId({ docId: node.properties.docId });
+ this.newBranchFileId = response.fileId;
+ } catch (error) {
+ console.error('Failed to fetch file ID:', error);
+ alert('无法获取文件ID,请稍后再试。');
+ return;
+ }
+
this.isModalVisible = true; // 显示模态框
},
+ getFileIdByDocId(data) {
+ return getFileIdByDocId(data);
+ },
closeModal() {
this.isModalVisible = false;
this.newBranchContent = '';
@@ -301,7 +357,7 @@ export default {
}
},
mounted() {
- this.testInfo();
+ this.doLogin();
this.getInfo();
}