hanyuqing 7 months ago
parent
commit
756f30c9de
  1. 2
      gyxtp/src/router/router.js
  2. 2351
      gyxtp/src/view/graphPageCopy.vue
  3. 238
      gyxtp/src/view/small.vue
  4. 1350
      gyxtp/src/view/smallCopy.vue
  5. 2
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/ZhyFileManageController.java
  6. 4
      ruoyi-system/src/main/java/com/ruoyi/system/service/impl/WordSplitter.java
  7. 112
      ruoyi-ui/src/views/system/fileManage/index.vue

2
gyxtp/src/router/router.js

@ -22,7 +22,7 @@ const routes = [
meta: {
title: '数据图谱',
},
component: () => import ("../view/graphPage.vue")
component: () => import ("../view/graphPageCopy.vue")
},
{
path: '/battlefield',

2351
gyxtp/src/view/graphPageCopy.vue

File diff suppressed because it is too large

238
gyxtp/src/view/small.vue

@ -196,7 +196,7 @@
<!-- {{graphData.nodes}}-->
<!-- <RelationGraph ref="graphRef" :options="graphOptions" :nodes="graphData.nodes" :links="graphData.links"-->
<!-- :on-node-click="onNodeClick" :on-line-click="onLineClick" />-->
<RelationGraph ref="graphRef" :options="testoptions" :on-node-click="onNodeClick" :on-line-click="onLineClick"/>
<RelationGraph ref="graphRef" :options="graphOptions" :on-node-click="onNodeClick" :on-line-click="onLineClick"/>
</div>
</div>
@ -229,7 +229,7 @@
</template>
<script>
import RelationGraph, { RGJsonData, RGOptions } from 'relation-graph-vue3';
import RelationGraph, { RGJsonData, RGOptions ,Layout} from 'relation-graph-vue3';
import LayoutFactory from '@/assets/js/graphvis.layout.min.js'
import { config } from '@/assets/defaultConfig.js'
import { demoData } from '@/assets/demo2.js'
@ -239,7 +239,103 @@ import { getAllTitle, getDocInfo } from "@/api/api/doc";
import {getDomainGraphTest, getpoinAll, getpoinByName} from "@/api/api/graph";
import { Picture } from "@element-plus/icons-vue";
import { selectAticleByRelation } from '@/api/api/article'
class MyForceLayout extends Layout.ForceLayouter {
constructor(arg1, arg2, arg3) {
console.log('MyForceLayout..................');
super(arg1, arg2, arg3);
}
resetCalcNodes() {
// forCalcNodesforCalcNodes
// visibleNodesvisibleNodesforCalcNodes
this.forCalcNodes = [];
this.calcNodeMap = new WeakMap();
this.visibleNodes.forEach(thisNode => {
const calcNode = {
rgNode: thisNode,
Fx: 0,
Fy: 0,
x: thisNode.x,
y: thisNode.y,
ignoreForce: (thisNode.dragging || (this.justLayoutSingleNode && !thisNode.singleNode)),
force_weight: thisNode.force_weight || 1,
forceCenterOffset_X: (thisNode.width || thisNode.el.offsetWidth || 60) / 2,
forceCenterOffset_Y: (thisNode.height || thisNode.el.offsetHeight || 60) / 2,
fixed: thisNode.fixed || false,
myColor: thisNode.color
};
this.forCalcNodes.push(calcNode);
this.calcNodeMap.set(thisNode, calcNode);
});
}
calcNodesPosition() {
const nodes = this.forCalcNodes;
for (let i=0;i<this.forCalcNodes.length;i++) {
const __node1 = this.forCalcNodes[i];
if (__node1.ignoreForce) {
continue;
}
if (__node1.fixed) {
continue;
}
for (let j = 0; j < this.forCalcNodes.length;j++) {
// ij
if (i !== j) {
const __node2 = this.forCalcNodes[j];
if (__node2.ignoreForce) {
continue;
}
/**
* 任意两点之间都会在这里进行作用力分析
* 你可以在这里根据你自己的规则为他们施加作用力施加作用力的方式有两种
* 斥力 this.addGravityByNode(__node1, __node2);
* 牵引力 this.addElasticByLine(__node1, __node2, 0.5);
*/
//
this.addGravityByNode(__node1, __node2);
if (__node1.myColor === __node2.myColor) {
//
this.addElasticByLine(
__node1,
__node2,
1
);
}
}
}
}
}
}
const graphOptions = {
debug: true,
backgrounImageNoRepeat: true,
moveToCenterWhenRefresh: true,
zoomToFitWhenRefresh: true,
useAnimationWhenRefresh: false,
defaultLineColor: 'rgba(255, 255, 255, 0.6)',
defaultNodeColor: 'rgba(255, 255, 255, 0.6)',
defaultNodeBorderWidth: 1,
defaultNodeBorderColor: 'rgba(255, 255, 255, 0.3)',
defaultNodeFontColor: '#1b7702',
defaultNodeShape: 0,
defaultNodeWidth: 60,
defaultNodeHeight: 60,
toolBarDirection: 'h',
toolBarPositionH: 'right',
toolBarPositionV: 'bottom',
defaultPloyLineRadius: 10,
defaultLineShape: 1,
layout: {
layoutName: 'force',
from: 'center',
maxLayoutTimes: 100,
// disableLiveChanges: true,
force_node_repulsion: 2.26, // 1:0.1 -- 10
force_line_elastic: 0.01
// 线1, :0.1 -- 10
}
};
export default {
components: {
leftInfo,
@ -249,24 +345,10 @@ export default {
},
data() {
return {
resizeTimer: null,
getpoinName :"模糊综合评价方法",
testoptions: {
layout: {
layoutName: 'force',
animate: false, //
maxIterations: 50, //
fit: true,
padding: 80, //
// --- ---
idealEdgeLength: 200, // 🔥 100 200
nodeRepulsion: 150000, // 🔥
gravity: 0.05, // 🔽
stiffness: 200, //
damping: 0.85, //
distanceMin: 30,
distanceMax: 600 //
}
},
direction: "rtl",
// visGraph
visGraph: null,
@ -301,35 +383,7 @@ export default {
header: '提示信息', //
data: [] //
},
graphOptions: {
debug: false,
lineUseTextPath: true,
layout: {
layoutName: 'tree',
from: 'top',
levelDistance: 200, //
nodeDistance: 150, //
min_per_width: 120, //
max_per_width: 120, //
min_per_height: 300, //
max_per_height: 300, //
disableDrag: true, //
align: 'center', //
fixed: false, //
},
defaultlineWidth: 2,
defaultLineShape: 1,
defaultNodeShape: 0,
defaultLineFontSize: 80,
defaultNodeBorderWidth: 0,
defaultLineColor: 'rgb(255,255,255)',
defaultNodeColor: 'rgba(0, 206, 209, 1)',
lineLengths: 100,
defaultNodeFontSize: '20px', //
toolBarPositionH: 'right',
toolBarPositionV: 'top',
disableNodeClickEffect: true,
},
graphOptions,
currentNode: {}, //
attrbutes: [],//线
currentLink: {},// 线
@ -401,25 +455,8 @@ export default {
handleNodeClick(node) {
console.log(node);
},
loadPng() {
this.visGraph.saveImage();
},
//
async drawGraphData() {
this.graphData = this.demoData;
if (this.visGraph === null) {
this.createGraph();
this.visGraph.drawData(this.graphData);
this.visGraph.incremaNodesCodinate(this.graphData.nodes);
this.reLayout();
} else {
this.createGraph();
this.visGraph.drawData(this.graphData);
this.visGraph.incremaNodesCodinate(this.graphData.nodes);
this.reLayout();
}
this.loading = false;
},
//
createGraph() {
this.visGraph = new VisGraph(document.getElementById('graph-panel'), this.config)
@ -626,6 +663,27 @@ export default {
}
return res
},
async stopForceIfNeed() {
const graphInstance = this.$refs.graphRef.getInstance();
await graphInstance.stopAutoLayout();
},
async updateLayouterOptions() {
await this.stopForceIfNeed();
const graphInstance = this.$refs.graphRef.getInstance();
graphInstance.layouter.maxLayoutTimes = this.graphOptions.layout.maxLayoutTimes;
graphInstance.layouter.force_node_repulsion = this.graphOptions.layout.force_node_repulsion;
graphInstance.layouter.force_line_elastic = this.graphOptions.layout.force_line_elastic;
setTimeout(async() => {
await graphInstance.startAutoLayout();
}, 500);
},
async resetNodeColor() {
const graphInstance = this.$refs.graphRef.getInstance();
for (const node of graphInstance.getNodes()) {
node.color = ['red', 'yellow', 'blue'][Math.floor(Math.random() * 3)];
}
await this.updateLayouterOptions();
}
},
created() {
var that = this;
@ -672,6 +730,13 @@ export default {
if (res.nodes[i].type=="keyword" && res.nodes[i].text!=this.getpoinName){
continue
}
var level = 0;
if(res.nodes[i].type=="agency"){
level = 2
}
if(res.nodes[i].type=="author"){
level = 2
}
let t_data = {
id:res.nodes[i].id,
text:res.nodes[i].text,
@ -695,36 +760,19 @@ export default {
links:links
}
this.$refs.graphRef.setJsonData(data);
const graphInstance = this.$refs.graphRef.getInstance();
// 使
graphInstance.setLayouter(new MyForceLayout(graphInstance.layouter.layoutOptions, graphInstance.options, graphInstance))
this.stopForceIfNeed();
graphInstance.setJsonData(data);
if (this.useBigData) {
graphInstance.setZoom(30);
} else {
graphInstance.setZoom(80);
}
})
// getpoinAll().then((res) => {
// for (let i = 0;i<res.nodes.length;i++){
// let t_data = {
// id:res.nodes[i].id,
// text:res.nodes[i].text,
// color:this.getColor(res.nodes[i].type),
// }
// res.nodes[i] = t_data
// }
// for (let i = 0;i<res.links.length;i++){
// let t_data = {
// from:res.links[i].from,
// to:res.links[i].to,
// text:res.links[i].text,
// }
// res.links[i] = t_data
// }
//
//
//
// var data = {
// nodes:res.nodes,
// links:res.links
// }
//
// this.$refs.graphRef.setJsonData(data);
// })

1350
gyxtp/src/view/smallCopy.vue

File diff suppressed because it is too large

2
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/ZhyFileManageController.java

@ -115,7 +115,7 @@ public class ZhyFileManageController extends BaseController {
webSocket.sendOneMessage(String.valueOf(getUserId()), "正在解析分词");
zhyFileManageService.wordSplitter(fileInputStream, url + "\\wordSplitter", zhyFileManage.getId(),null,fileInfo);
webSocket.sendOneMessage(String.valueOf(getUserId()), "正在创建索引");
zhyFileManageService.createIndex(url + "\\wordSplitter", "D:\\project\\gyx\\tupudata\\fileManager\\index");
// zhyFileManageService.createIndex(url + "\\wordSplitter", "D:\\project\\gyx\\tupudata\\fileManager\\index");
webSocket.sendOneMessage(String.valueOf(getUserId()), "正在建立关系");
zhyFileManageService.getRelationShip(zhyFileManage.getId());
webSocket.sendOneMessage(String.valueOf(getUserId()), "正在创建图谱");

4
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/WordSplitter.java

@ -109,7 +109,7 @@ public class WordSplitter {
MultipartFile multipartFile = new Base64ToMultipartFile(
base64Image,
"pic"+new Date().getTime()+fileExtension,
"pic"+new Date().getTime()+".png",
contentType
);
// 上传并返回新文件名称
@ -471,7 +471,7 @@ public class WordSplitter {
MultipartFile multipartFile = new Base64ToMultipartFile(
base64Image,
"pic"+new Date().getTime()+fileExtension,
"pic"+new Date().getTime()+".png",
contentType
);
// 上传并返回新文件名称

112
ruoyi-ui/src/views/system/fileManage/index.vue

@ -128,6 +128,7 @@
label="操作">
<template slot-scope="scope">
<el-button size="mini" @click.stop="selectTemplate(scope.row)">选择</el-button>
<el-button size="mini" @click.stop="updatetemplate(scope.row)">修改</el-button>
<el-button size="mini" @click.stop="handleDelete(scope.row.id)">删除</el-button>
</template>
</el-table-column>
@ -178,7 +179,7 @@
</el-dialog>
<!-- 模板编辑器对话框 -->
<el-dialog title='创建新模板' :visible.sync="templateEditor.visible" width="700px" append-to-body>
<el-dialog :title="templeteTitle" :visible.sync="templateEditor.visible" width="700px" append-to-body>
<el-form :model="templateEditor.form" label-width="100px" :rules="templateRules" ref="templateForm">
<el-form-item label="模板名称" prop="name">
<el-input v-model="templateEditor.form.name" placeholder="请输入模板名称" maxlength="20"
@ -426,6 +427,7 @@ import {
} from "@/api/system/file";
import Editor from '@/components/Editor/index.vue'
import {deletAllInfoNew, deleteDocTitleOnly} from "../../../api/system/file";
import {updateTemplate} from "../../../api/system/titleTemplate";
export default {
components: {
@ -433,6 +435,7 @@ export default {
},
data() {
return {
templeteTitle:"创建新模板",
//
templateDialog: {
visible: false,
@ -705,6 +708,9 @@ export default {
this.templateEditor.form.level2 = ""
this.templateEditor.form.level3 = ""
this.templateEditor.form.level4 = ""
this.templateEditor.form.level5 = ""
this.templateEditor.form.level6 = ""
this.templateEditor.form.level7 = ""
this.templateEditor.form.name = ""
this.titleOptions = this.titleOptions1
},
@ -713,11 +719,17 @@ export default {
const option2 = this.templateEditor.form.level2;
const option3 = this.templateEditor.form.level3;
const option4 = this.templateEditor.form.level4;
const option5 = this.templateEditor.form.level5;
const option6 = this.templateEditor.form.level6;
const option7 = this.templateEditor.form.level7;
this.titleOptions = this.titleOptions.filter(option =>
option.value !== option1 &&
option.value !== option2 &&
option.value !== option3 &&
option.value !== option4
option.value !== option4 &&
option.value !== option5 &&
option.value !== option6 &&
option.value !== option7
);
console.log(this.titleOptions)
},
@ -754,31 +766,89 @@ export default {
});
},
updatetemplate(row) {
this.templateEditor.visible = true;
this.templeteTitle = "修改模板信息"
console.log(row)
this.templateEditor.form.id = row.id
//
this.templateEditor.form.name = row.name
this.templateEditor.form.level1 = row.firstTitle
this.templateEditor.form.level2 = row.secondTitle
this.templateEditor.form.level3 = row.thirdTitle
this.templateEditor.form.level4 = row.fourthTitle
this.templateEditor.form.level5 = row.fiveTitle
this.templateEditor.form.level6 = row.sixTitle
this.templateEditor.form.level7 = row.sevenTitle
},
selectTemplate(template) {
this.selectedTemplate = template;
},
saveTemplate() {
var template = {
"name": this.templateEditor.form.name,
"firstTitle": this.templateEditor.form.level1,
"secondTitle": this.templateEditor.form.level2,
"thirdTitle": this.templateEditor.form.level3,
"fourthTitle": this.templateEditor.form.level4,
"fiveTitle": this.templateEditor.form.level5,
"sixTitle": this.templateEditor.form.level6,
"sevenTitle": this.templateEditor.form.level7,
console.log(this.templateEditor.form)
if(this.templateEditor.form.id==null){
var template = {
"name": this.templateEditor.form.name,
"firstTitle": this.templateEditor.form.level1,
"secondTitle": this.templateEditor.form.level2,
"thirdTitle": this.templateEditor.form.level3,
"fourthTitle": this.templateEditor.form.level4,
"fiveTitle": this.templateEditor.form.level5,
"sixTitle": this.templateEditor.form.level6,
"sevenTitle": this.templateEditor.form.level7,
}
addTemplate(template).then((res) => {
this.handleImport();
})
this.templateEditor.visible = false;
this.templateEditor.form.level1 = ""
this.templateEditor.form.level2 = ""
this.templateEditor.form.level3 = ""
this.templateEditor.form.level4 = ""
this.templateEditor.form.level5 = ""
this.templateEditor.form.level6 = ""
this.templateEditor.form.level7 = ""
this.templateEditor.form.name = ""
this.titleOptions = this.titleOptions1
}else {
var template = {
"id":this.templateEditor.form.id,
"name": this.templateEditor.form.name,
"firstTitle": this.templateEditor.form.level1,
"secondTitle": this.templateEditor.form.level2,
"thirdTitle": this.templateEditor.form.level3,
"fourthTitle": this.templateEditor.form.level4,
"fiveTitle": this.templateEditor.form.level5,
"sixTitle": this.templateEditor.form.level6,
"sevenTitle": this.templateEditor.form.level7,
}
updateTemplate(template).then((res) => {
this.handleImport();
})
this.templateEditor.visible = false;
this.templateEditor.form.level1 = ""
this.templateEditor.form.level2 = ""
this.templateEditor.form.level3 = ""
this.templateEditor.form.level4 = ""
this.templateEditor.form.level5 = ""
this.templateEditor.form.level6 = ""
this.templateEditor.form.level7 = ""
this.templateEditor.form.id = null
this.templateEditor.form.name = ""
this.titleOptions = this.titleOptions1
}
addTemplate(template).then((res) => {
this.handleImport();
})
this.templateEditor.visible = false;
this.templateEditor.form.level1 = ""
this.templateEditor.form.level2 = ""
this.templateEditor.form.level3 = ""
this.templateEditor.form.level4 = ""
this.templateEditor.form.name = ""
this.titleOptions = this.titleOptions1
},
confirmTemplate() {

Loading…
Cancel
Save