zhangxiaomeng 1 year ago
parent
commit
6e8e782169
  1. 45
      kcui/src/view/Graph.vue

45
kcui/src/view/Graph.vue

@ -1,10 +1,12 @@
<template> <template>
<div style="width: 100%;height: 100%;"> <div style="width: 100%;height: 100%;">
<div style="width: 100%;height: 4vw;background-color: #42b983;"> <div style="width: 100%;height: 4vw;background-color: #42b983;">
<div style="background-color: silver;width: 3vw;height: 2vw;line-height: 2vw;text-align: center;" @click="goBook">跳转1</div> <div style="background-color: silver;width: 3vw;height: 2vw;line-height: 2vw;text-align: center;" @click="goBook">
跳转1
</div>
<div class="stText">关键字:</div> <div class="stText">关键字:</div>
<input class="stInput" placeholder="请输入关键字" v-model="keywords"/> <input class="stInput" placeholder="请输入关键字" v-model="keywords"/>
<div @click="getInfo" <div @click="getInfo1"
style="width: 4vw;height: 2vw;margin-left:0.2vw;background-color: #0AB7FD;float: right;font-size: 1vw;line-height: 2vw;text-align: center;border-radius:2vw;margin-top: 0.1vw;"> style="width: 4vw;height: 2vw;margin-left:0.2vw;background-color: #0AB7FD;float: right;font-size: 1vw;line-height: 2vw;text-align: center;border-radius:2vw;margin-top: 0.1vw;">
查询 查询
</div> </div>
@ -102,16 +104,10 @@ export default {
onCreated(editor) { onCreated(editor) {
this.editor = Object.seal(editor) // Object.seal() this.editor = Object.seal(editor) // Object.seal()
}, },
// getInfo(){
// var data = {}
// getgraphInfo(data).then((res)=>{
// this.zhengl(res.data);
//
// })
// },
getInfo() { getInfo() {
this.graphData = undefined;
this.demoData = {}
this.data = undefined;
if (this.keywords != '' && this.keywords != undefined) { if (this.keywords != '' && this.keywords != undefined) {
this.visGraph.clearAll(); this.visGraph.clearAll();
let params = { let params = {
@ -123,7 +119,28 @@ export default {
} else { } else {
let params = {}; let params = {};
getgraphInfo(params).then((res) => {
this.zhengl(res.data);
})
}
},
getInfo1() {
this.graphData = undefined;
this.demoData = {}
if (this.keywords != '' && this.keywords != undefined) {
this.visGraph.clearAll();
let params = {
nodename: this.keywords,
};
getgraphInfo(params).then((res) => {
this.zhengl(res.data);
})
} else {
this.visGraph.clearAll();
let params = {};
getgraphInfo(params).then((res) => { getgraphInfo(params).then((res) => {
this.zhengl(res.data); this.zhengl(res.data);
}) })
@ -131,24 +148,20 @@ export default {
}, },
async drawGraphData() { async drawGraphData() {
this.graphData = this.demoData; this.graphData = this.demoData;
if (this.visGraph === null) { if (this.visGraph === null) {
this.createGraph(); this.createGraph();
// this.genrateGraphData(); // this.genrateGraphData();
this.visGraph.drawData(this.graphData); this.visGraph.drawData(this.graphData);
// this.refreshGraphData();
this.visGraph.incremaNodesCodinate(this.graphData.nodes); this.visGraph.incremaNodesCodinate(this.graphData.nodes);
this.reLayout(); this.reLayout();
// this.goCenter();
} else { } else {
this.createGraph(); this.createGraph();
this.visGraph.drawData(this.graphData); this.visGraph.drawData(this.graphData);
// this.refreshGraphData();
this.visGraph.incremaNodesCodinate(this.graphData.nodes); this.visGraph.incremaNodesCodinate(this.graphData.nodes);
this.reLayout(); this.reLayout();
// this.goCenter();
} }
this.loading = false; this.loading = false;
@ -167,8 +180,6 @@ export default {
this.visGraph = new VisGraph(document.getElementById('graph-panel'), configWithEvents); this.visGraph = new VisGraph(document.getElementById('graph-panel'), configWithEvents);
}, },
async showPopup(node) { async showPopup(node) {
console.log("o----------")
console.log(node)
this.selectedNode = node; this.selectedNode = node;
this.newBranchParentId = node.properties.docId; this.newBranchParentId = node.properties.docId;
this.newBranchLevel = parseInt(node.properties.level) + 1; this.newBranchLevel = parseInt(node.properties.level) + 1;

Loading…
Cancel
Save