Browse Source

Merge branch 'zxm' of http://124.70.32.114:3100/zhangxiaomeng/kechengfuzhu into wzx

# Conflicts:
#	kcui/src/view/Graph.vue
wzx
linsheng0116 1 year ago
parent
commit
6631dbeb58
  1. 112
      kcui/src/view/Graph.vue

112
kcui/src/view/Graph.vue

@ -1,10 +1,12 @@
<template>
<div style="width: 100%;height: 100%;">
<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>
<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;">
查询
</div>
@ -30,9 +32,10 @@
</el-form-item>
<el-form-item label="类型">
<el-select v-model="typeValue" placeholder="请选择类型">
<el-option label="图文" value="图文"></el-option>
<el-option label="视频" value="视频"></el-option>
<el-option label="动画" value="动画"></el-option>
<el-option label="图文" value="tw"></el-option>
<el-option label="视频" value="sp"></el-option>
<el-option label="动画" value="dh"></el-option>
<el-option label="计算模块" value="jsmk"></el-option>
</el-select>
</el-form-item>
<el-form-item label="节点名称">
@ -70,11 +73,11 @@ import {addNode, getFileIdByDocId} from "@/api/file";
export default {
// eslint-disable-next-line vue/multi-word-component-names
name: 'Graph',
name: 'Home',
data() {
return{
infos:[],
demoData:{},
return {
infos: [],
demoData: {},
graphData: {
nodes: [],
links: []
@ -89,28 +92,22 @@ export default {
newBranchFileId: '',
newBranchLevel: null,
newBranchParentId: '',
newBranchRelation:'',
newBranchRelation: '',
typeValue: '',
keywords: '',
}
},
methods:{
goBook(){
this.$router.push({name:'Book',query: {id:'1'}})
methods: {
goBook() {
this.$router.push({name: 'Book', query: {id: '1'}})
},
onCreated(editor) {
this.editor = Object.seal(editor) // Object.seal()
},
// getInfo(){
// var data = {}
// getgraphInfo(data).then((res)=>{
// this.zhengl(res.data);
//
// })
// },
getInfo() {
this.graphData = undefined;
this.demoData = {}
this.data = undefined;
if (this.keywords != '' && this.keywords != undefined) {
this.visGraph.clearAll();
let params = {
@ -122,7 +119,28 @@ export default {
} else {
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) => {
this.zhengl(res.data);
})
@ -130,24 +148,20 @@ export default {
},
async drawGraphData() {
this.graphData = this.demoData;
if (this.visGraph === null) {
this.createGraph();
// this.genrateGraphData();
this.visGraph.drawData(this.graphData);
// this.refreshGraphData();
this.visGraph.incremaNodesCodinate(this.graphData.nodes);
this.reLayout();
// this.goCenter();
} else {
this.createGraph();
this.visGraph.drawData(this.graphData);
// this.refreshGraphData();
this.visGraph.incremaNodesCodinate(this.graphData.nodes);
this.reLayout();
// this.goCenter();
}
this.loading = false;
@ -166,14 +180,12 @@ export default {
this.visGraph = new VisGraph(document.getElementById('graph-panel'), configWithEvents);
},
async showPopup(node) {
console.log("o----------")
console.log(node)
this.selectedNode = node;
this.newBranchParentId = node.properties.docId;
this.newBranchLevel = parseInt(node.properties.level) + 1;
this.newBranchLevel = parseInt(node.properties.level) + 1;
try {
const response = await this.getFileIdByDocId({ docId: node.properties.docId });
const response = await this.getFileIdByDocId({docId: node.properties.docId});
this.newBranchFileId = response.fileId;
} catch (error) {
console.error('Failed to fetch file ID:', error);
@ -216,7 +228,7 @@ export default {
const newNode = {
id: newNodeId,
label: content,
properties: { name: content, docId: newNodeId, level: this.newBranchLevel },
properties: {name: content, docId: newNodeId, level: this.newBranchLevel},
...this.getNodeStyle(this.newBranchLevel) //
};
const newLink = {
@ -290,7 +302,7 @@ export default {
var allOne = ""
console.log(nodeList)
if(nodeList!=undefined){
if (nodeList != undefined) {
allOne = nodeList[0].docId
for (let a = 0; a < nodeList.length; a++) {
const group = parseInt(nodeList[a].group, 10);
@ -299,7 +311,7 @@ export default {
nodes.push({
id: nodeList[a].id,
label: nodeList[a].name,
properties: { name: nodeList[a].name, docId: nodeList[a].docId, parent: allOne, leve: nodeList[a].group },
properties: {name: nodeList[a].name, docId: nodeList[a].docId, parent: allOne, leve: nodeList[a].group},
...style // style
});
}
@ -308,7 +320,7 @@ export default {
// var allOne = nodeList[0].docId
if(lineList!=undefined){
if (lineList != undefined) {
for (let b = 0; b < lineList.length; b++) {
var bbb = {name: lineList[b].relate}
@ -332,34 +344,28 @@ export default {
},
getNodeStyle(group) {
const styles = [
{ size: 450, color: '227,203,0', font: 'normal 70px Arial', fontColor: '255,255,255' },
{ size: 350, width: 350, height: 300, color: '47,47,230', font: 'normal 68px Arial', fontColor: '255,255,255' },
{ size: 300, width: 300, height: 250, color: '255,138,0', font: 'normal 50px Arial', fontColor: '255,255,255' },
{ size: 250, width: 250, height: 250, color: '30,255,0', font: 'normal 40px Arial', fontColor: '0,0,0' },
{ size: 200, width: 200, height: 200, color: '248,143,248', font: 'normal 32px Arial', fontColor: '255,255,255' },
{ size: 150, width: 150, height: 150, color: '65,154,255', font: 'normal 30px Arial', fontColor: '255,255,255' },
{ size: 100, width: 100, height: 100, color: '0,228,255', font: 'normal 28px Arial', fontColor: '0,0,0' }
{size: 450, color: '227,203,0', font: 'normal 70px Arial', fontColor: '255,255,255'},
{size: 350, width: 350, height: 300, color: '47,47,230', font: 'normal 68px Arial', fontColor: '255,255,255'},
{size: 300, width: 300, height: 250, color: '255,138,0', font: 'normal 50px Arial', fontColor: '255,255,255'},
{size: 250, width: 250, height: 250, color: '30,255,0', font: 'normal 40px Arial', fontColor: '0,0,0'},
{size: 200, width: 200, height: 200, color: '248,143,248', font: 'normal 32px Arial', fontColor: '255,255,255'},
{size: 150, width: 150, height: 150, color: '65,154,255', font: 'normal 30px Arial', fontColor: '255,255,255'},
{size: 100, width: 100, height: 100, color: '0,228,255', font: 'normal 28px Arial', fontColor: '0,0,0'}
];
return styles[group] || {};
},
// doLogin(){
// userLogin().then((res)=>{
// console.log(res);
// this.testInfo();
// this.getInfo();
// })
// },
testInfo(){
test().then((res)=>{
testInfo() {
test().then((res) => {
console.log(res);
})
}
},
mounted() {
this.doLogin();
this.getInfo();
mounted() {
this.testInfo();
this.getInfo();
}
}
</script>

Loading…
Cancel
Save