提交一版

master
hujunbo 3 years ago
parent 959678187e
commit 1e719517e5

@ -1,7 +1,9 @@
package com.ruoyi.biemo.business.controller;
import com.alibaba.fastjson.JSONObject;
import com.ruoyi.biemo.business.domain.Category;
import com.ruoyi.biemo.business.domain.DocInfo;
import com.ruoyi.biemo.business.service.CategoryService;
import com.ruoyi.biemo.business.service.DocInfoService;
import com.ruoyi.biemo.core.page.Page;
import com.ruoyi.biemo.core.page.PageFactory;
@ -30,6 +32,8 @@ public class DocInfoController extends BaseController {
@Autowired
private DocInfoService docInfoService;
@Autowired
private CategoryService categoryService;
/**
*
*/
@ -38,6 +42,13 @@ public class DocInfoController extends BaseController {
public Page<DocInfo> list(DocInfo docInfo)
{
Page<DocInfo> page = docInfoService.selectDocInfoPage(docInfo,PageFactory.defaultPage());
page.getRows().forEach(doc->{
Category category = new Category();
category = categoryService.selectCategoryById(doc.getCateId());
if(category!=null&&category.getName()!=null){
doc.setCateName(category.getName());
}
});
return page;
}
@ -93,4 +104,9 @@ public class DocInfoController extends BaseController {
public AjaxResult analysis(@PathVariable String id){
return AjaxResult.success(docInfoService.analysis(id));
}
@GetMapping("/summary/{id}")
public AjaxResult summary(@PathVariable String id){
return AjaxResult.success(docInfoService.summary(id));
}
}

@ -57,6 +57,10 @@ public class DocInfo implements Serializable {
private Long updatedBy;
@FieldInfo(type = "keyword",participle = 0)
private Integer isSync;
@FieldInfo(type = "keyword",participle = 0)
private Integer hot;
@FieldInfo(type = "keyword",participle = 0)
private Integer recommend;
@CreateTime
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@FieldInfo(type = "datetime",participle = 0)
@ -72,4 +76,6 @@ public class DocInfo implements Serializable {
//情感数据
private String parserEmotion;
private String cateName;
}

@ -61,7 +61,11 @@ public class CategoryService extends EsService<Category> {
*/
public Category selectCategoryById(String id)
{
return esLambdaQuery().eq(Category::getId,id).query().get(0);
if(id==null||id.trim().length()==0){
return null;
}
List<Category> categories = esLambdaQuery().eq(Category::getId,id).query();
return categories!=null&&categories.size()>0?categories.get(0):null;
}
/**

@ -12,6 +12,7 @@ import com.ruoyi.biemo.core.page.Page;
import com.ruoyi.biemo.elasticsearch.util.EsService;
import com.ruoyi.biemo.mongodb.utils.MongoHelper;
import com.ruoyi.biemo.nlp.DependencyParserUtils;
import com.ruoyi.biemo.nlp.SummaryUtils;
import com.ruoyi.biemo.utils.MyObjects;
import com.ruoyi.common.utils.StringUtils;
import org.elasticsearch.search.SearchHit;
@ -23,6 +24,7 @@ import org.springframework.context.ApplicationEvent;
import org.springframework.context.event.EventListener;
import org.springframework.stereotype.Service;
import javax.print.Doc;
import java.util.*;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.stream.Collectors;
@ -65,7 +67,11 @@ public class DocInfoService extends EsService<DocInfo> {
*/
public DocInfo selectDocInfoById(String id)
{
return esLambdaQuery().eq(DocInfo::getId,id).query().get(0);
if(id==null||id.trim().length()==0){
return null;
}
List<DocInfo> docInfos = esLambdaQuery().eq(DocInfo::getId,id).query();
return docInfos!=null&&docInfos.size()>0?docInfos.get(0):null;
}
/**
@ -190,20 +196,21 @@ public class DocInfoService extends EsService<DocInfo> {
String relationName = nrn[1];
String nodeName2 = nrn[2];
Node node1 = new Node();
node1.setId(nodesMap.get(nodeName1));
node1.setLabels(new ArrayList<String>(){{add(nodeName1);}});
//node1.setId(nodesMap.get(nodeName1));
node1.setId(nodeName1);
node1.setLabels(new ArrayList<String>(){{add(nodeName1);add("通信");}});
node1.setProperties(new HashMap<String,Object>(){{put("name",nodeName1);put("email","9094908@qq.com");}});
Node node2 = new Node();
node2.setId(nodesMap.get(nodeName2));
node2.setLabels(new ArrayList<String>(){{add(nodeName2);}});
node2.setId(nodeName2);
node2.setLabels(new ArrayList<String>(){{add(nodeName2);add("雷达");}});
node2.setProperties(new HashMap<String,Object>(){{put("name",nodeName2);put("email","9094908@qq.com");}});
nodes.add(node1);
nodes.add(node2);
Relationship relationship = new Relationship();
relationship.setId(String.valueOf(i++));
relationship.setType(relationName);
relationship.setStartNode(node1.getId());
relationship.setEndNode(node2.getId());
relationship.setStartNode(nodeName1);
relationship.setEndNode(nodeName2);
relationship.setProperties(new HashMap<String,Object>(){{put("source",nodeName1);put("relation",relationName);put("target",nodeName2);}});
relationships.add(relationship);
}
@ -268,4 +275,12 @@ public class DocInfoService extends EsService<DocInfo> {
System.out.println(JSONObject.toJSONString(response));
return response;
}
public String summary(String id) {
DocInfo docInfo = this.selectDocInfoById(id);
String summary = SummaryUtils.autoSummary(docInfo.getContent());
docInfo.setSummary(summary);
this.insertOrUpdateDocInfo(docInfo);
return summary;
}
}

@ -0,0 +1,17 @@
package com.ruoyi.biemo.nlp;
import com.hankcs.hanlp.dictionary.CoreSynonymDictionary;
//相似度计算
public class WordDistanceUtils {
//语义距离
public Long distance(String a,String b){
return CoreSynonymDictionary.distance(a, b);
}
//语义相似度
public Double similarity(String a,String b){
return CoreSynonymDictionary.similarity(a, b);
}
}

@ -32,30 +32,30 @@ public class DemoPerceptronLexicalAnalyzer extends TestUtility
PerceptronLexicalAnalyzer analyzer = new PerceptronLexicalAnalyzer("data/model/perceptron/pku199801/cws.bin",
HanLP.Config.PerceptronPOSModelPath,
HanLP.Config.PerceptronNERModelPath);
System.out.println(analyzer.analyze("上海华安工业(集团)公司董事长谭旭光和秘书胡花蕊来到美国纽约现代艺术博物馆参观"));
System.out.println(analyzer.analyze("微软公司於1975年由比爾·蓋茲和保羅·艾倫創立18年啟動以智慧雲端、前端為導向的大改組。"));
//System.out.println(analyzer.analyze("上海华安工业(集团)公司董事长谭旭光和秘书胡花蕊来到美国纽约现代艺术博物馆参观").translateLabels());
//System.out.println(analyzer.analyze("微软公司於1975年由比爾·蓋茲和保羅·艾倫創立18年啟動以智慧雲端、前端為導向的大改組。").translateLabels());
// 任何模型总会有失误特别是98年这种陈旧的语料库
System.out.println(analyzer.analyze("总统普京与特朗普通电话讨论太空探索技术公司"));
System.out.println(analyzer.analyze("总统普京与特朗普通电话讨论太空探索技术公司").translateLabels());
// 支持在线学习
analyzer.learn("与/c 特朗普/nr 通/v 电话/n 讨论/v [太空/s 探索/vn 技术/n 公司/n]/nt");
// 学习到新知识
System.out.println(analyzer.analyze("总统普京与特朗普通电话讨论太空探索技术公司"));
//System.out.println(analyzer.analyze("总统普京与特朗普通电话讨论太空探索技术公司"));
// 还可以举一反三
System.out.println(analyzer.analyze("主席和特朗普通电话"));
//System.out.println(analyzer.analyze("主席和特朗普通电话"));
// 知识的泛化不是死板的规则,而是比较灵活的统计信息
System.out.println(analyzer.analyze("我在浙江金华出生"));
analyzer.learn("在/p 浙江/ns 金华/ns 出生/v");
System.out.println(analyzer.analyze("我在四川金华出生,我的名字叫金华"));
//System.out.println(analyzer.analyze("我在浙江金华出生"));
//analyzer.learn("在/p 浙江/ns 金华/ns 出生/v");
//System.out.println(analyzer.analyze("我在四川金华出生,我的名字叫金华"));
// 在线学习后的模型支持序列化,以分词模型为例:
// analyzer.getPerceptronSegmenter().getModel().save(HanLP.Config.PerceptronCWSModelPath);
//analyzer.getPerceptronSegmenter().getModel().save("data/model/perceptron/pku199801/cws.bin");
//analyzer.getPerceptronPOSTagger().getModel().save(HanLP.Config.PerceptronPOSModelPath);
// 请用户按需执行对空格制表符等的预处理,只有你最清楚自己的文本中都有些什么奇怪的东西
System.out.println(analyzer.analyze("空格 \t\n\r\f&nbsp;统统都不要"
.replaceAll("\\s+", "") // 去除所有空白符
.replaceAll("&nbsp;", "") // 如果一些文本中含有html控制符
));
// System.out.println(analyzer.analyze("空格 \t\n\r\f&nbsp;统统都不要"
// .replaceAll("\\s+", "") // 去除所有空白符
// .replaceAll("&nbsp;", "") // 如果一些文本中含有html控制符
// ));
}
}
}

@ -1,10 +1,46 @@
<template>
<div id="neo4jd3"></div>
<el-row :gutter="20">
<el-col :span="12"><div class="grid-content bg-purple">
<el-card class="box-card">
<div slot="header" class="clearfix">
<span></span>
</div>
<!-- 大标题 -->
<h3 class="title">{{ docInfo.title }}</h3>
<!-- 子标题 -->
<p class="subtitle">
<span>作者{{ docInfo.author }}<span v-html="'&nbsp;&nbsp;'"></span></span>
<span>来源{{ docInfo.source }}<span v-html="'&nbsp;&nbsp;'"></span></span>
<span>时间{{ parseTime(docInfo.createTime, '{y}-{m}-{d} {h}:{i}:{s}') }} <span v-html="'&nbsp;&nbsp;'"></span></span>
</p>
<hr>
<!-- 内容区域 -->
<div class="content">
<neo4jd3 :id="this.id"></neo4jd3>
</div>
</el-card>
</div>
</el-col>
<el-col :span="12">
<div class="grid-content bg-purple">
<myCard :flag="'HOT!'" :cardName="'热点新闻'" :hot="1" ></myCard>
<myCard :flag="'推荐!'" :cardName="'推荐新闻'" :recommend="1"></myCard>
</div>
</el-col>
</el-row>
</template>
<script>
import { getDocInfoAnalysis } from "@/api/biemo/docInfo";
import Neo4jd3 from "@/views/neo4jd3/js/neo4jd3";
import { getDocInfo } from "@/api/biemo/docInfo";
import myCard from "@/views/components/myCard";
import neo4jd3 from "@/views/neo4jd3/index";
export default {
components: { myCard ,neo4jd3},
data(){
return{
docInfo: {},
@ -12,93 +48,67 @@ export default {
}
},
props: ["id"],
created(){
},
async mounted() {
await this.getData(this.id);
mounted(){
this.getDocInfoById(this.id);
},
methods: {
async getData(id){
let res = await getDocInfoAnalysis(id);
this.docInfo = res.data;
this.init();
},
init() {
var neo4jd3 = new Neo4jd3('#neo4jd3', {
highlight: [
{
class: 'Project',
property: 'name',
value: 'neo4jd3'
}, {
class: 'User',
property: 'userId',
value: 'eisman'
}
],
icons: {
'Api': 'gear',
'Cookie': 'paw',
'Email': 'at',
'Git': 'git',
'Github': 'github',
'Google': 'google',
'Ip': 'map-marker',
'Issues': 'exclamation-circle',
'Language': 'language',
'Options': 'sliders',
'Password': 'lock',
'Phone': 'phone',
'Project': 'folder-open',
'SecurityChallengeAnswer': 'commenting',
'User': 'user',
'zoomFit': 'arrows-alt',
'zoomIn': 'search-plus',
'zoomOut': 'search-minus'
},
images: {
'Address': 'img/twemoji/1f3e0.svg',
'BirthDate': 'img/twemoji/1f382.svg',
'Cookie': 'img/twemoji/1f36a.svg',
'CreditCard': 'img/twemoji/1f4b3.svg',
'Device': 'img/twemoji/1f4bb.svg',
'Email': 'img/twemoji/2709.svg',
'Git': 'img/twemoji/1f5c3.svg',
'Github': 'img/twemoji/1f5c4.svg',
'icons': 'img/twemoji/1f38f.svg',
'Ip': 'img/twemoji/1f4cd.svg',
'Issues': 'img/twemoji/1f4a9.svg',
'Language': 'img/twemoji/1f1f1-1f1f7.svg',
'Options': 'img/twemoji/2699.svg',
'Password': 'img/twemoji/1f511.svg',
'Project': 'img/twemoji/2198.svg',
'Project|name|neo4jd3': 'img/twemoji/2196.svg',
'User': 'img/twemoji/1f600.svg'
},
minCollision: 60,
//neo4jDataUrl: '/dev-api/common/download/resource?resource=/profile/my.json',
neo4jData: this.docInfo,
nodeRadius: 25,
onNodeDoubleClick: function(node) {
},
onRelationshipDoubleClick: function(relationship) {
console.log('double click on relationship: ' + JSON.stringify(relationship));
},
zoomFit: true
getDocInfoById(id){
getDocInfo(id).then(response=>{
this.docInfo = response.data;
});
}
}
}
</script>
<style rel="stylesheet/scss" lang="scss">
@import '../neo4jd3/css/neo4jd3.css';
.neo4jd3 {
position: relative;
background: #fff;
height: 700px;
<style lang="scss">
.el-row {
margin-bottom: 20px;
&:last-child {
margin-bottom: 0;
}
}
</style>
.el-col {
border-radius: 4px;
}
.bg-purple-dark {
background: #f5f5f5;
}
.bg-purple {
background: #f7f7fa;
}
.bg-purple-light {
background: #e5e9f2;
}
.grid-content {
border-radius: 4px;
padding: 0 4px;
.title {
font-size: 20px;
text-align: center;
margin: 15px 0;
color: #188ffe;
}
.subtitle {
font-size: 16px;
color: #090909;
display: flex;
justify-content: center ;
}
.content {
width: 100%;
justify-content: center ;
font-size: 16px;
color: #393636;
font-family: 'Microsoft YaHei UI', 'Microsoft YaHei', DengXian, SimSun, 'Segoe UI', Tahoma, Helvetica, sans-serif;
}
}
.row-bg {
padding: 10px 0;
background-color: #f9fafc;
}
</style>

@ -0,0 +1,59 @@
<template>
<el-card class="box-card">
<div slot="header" class="clearfix">
<span>{{cardName}}</span>
</div>
<div v-for="(o,index) in docInfoList" :key="index" class="text item">
{{flag + ' ' +o.title +' '+ parseTime(o.updateTime,'{y}-{m}-{d})')}}
</div>
</el-card>
</template>
<script>
import { listDocInfo } from "@/api/biemo/docInfo";
export default {
data(){
return{
docInfo:{hot:this.hot,recommend:this.recommend},
docInfoList:[]
}
},
props: ["cardName","hot","recommend","flag"],
mounted(){
this.getList(this.docInfo)
},
methods: {
getList(query){
listDocInfo(query).then(response=>{
this.docInfoList = response.rows;
})
}
}
}
</script>
<style scoped>
.text {
font-size: 14px;
}
.item {
margin-bottom: 18px;
}
.clearfix:before,
.clearfix:after {
display: table;
content: "";
}
.clearfix:after {
clear: both
}
.box-card {
width: 480px;
margin-bottom: 50px;
}
</style>

@ -1,38 +1,52 @@
<template>
<div class="newsinfo-detail-main">
<div class="newsinfo-container">
<!-- 大标题 -->
<h3 class="title">{{ docInfo.title }}</h3>
<!-- 子标题 -->
<p class="subtitle">
<el-row :gutter="20">
<el-col :span="12"><div class="grid-content bg-purple">
<el-card class="box-card">
<div slot="header" class="clearfix">
<span></span>
</div>
<!-- 大标题 -->
<h3 class="title">{{ docInfo.title }}</h3>
<!-- 子标题 -->
<p class="subtitle">
<span>作者{{ docInfo.author }}<span v-html="'&nbsp;&nbsp;'"></span></span>
<span>来源{{ docInfo.source }}<span v-html="'&nbsp;&nbsp;'"></span></span>
<span>时间{{ parseTime(docInfo.createTime, '{y}-{m}-{d} {h}:{i}:{s}') }} <span v-html="'&nbsp;&nbsp;'"></span></span>
</p>
<hr>
<!-- 内容区域 -->
<div class="content" v-html="docInfo.content"></div>
</el-card>
<span>作者{{ docInfo.author }}<span v-html="'&nbsp;&nbsp;'"></span></span>
<span>来源{{ docInfo.source }}<span v-html="'&nbsp;&nbsp;'"></span></span>
<span>时间{{ parseTime(docInfo.createTime, '{y}-{m}-{d} {h}:{i}:{s}') }} <span v-html="'&nbsp;&nbsp;'"></span></span>
</p>
<hr>
<!-- 内容区域 -->
<div class="content" v-html="docInfo.content"></div>
</div>
<div class="newsinfo-right">
</div>
</div>
</el-col>
<el-col :span="12">
<div class="grid-content bg-purple">
<myCard :flag="'HOT!'" :cardName="'热点新闻'" :hot="1" ></myCard>
<myCard :flag="'推荐!'" :cardName="'推荐新闻'" :recommend="1"></myCard>
</div>
</el-col>
</el-row>
</template>
<script>
import { getDocInfo } from "@/api/biemo/docInfo";
import myCard from "@/views/components/myCard";
export default {
components: { myCard },
data(){
return{
docInfo: {},
isOpen: true
}
},
props: ["id"],
created(){
mounted(){
this.getDocInfoById(this.id);
},
methods: {
@ -46,10 +60,29 @@ export default {
</script>
<style lang="scss">
.newsinfo-container {
.el-row {
margin-bottom: 20px;
&:last-child {
margin-bottom: 0;
}
}
.el-col {
border-radius: 4px;
}
.bg-purple-dark {
background: #f5f5f5;
}
.bg-purple {
background: #f7f7fa;
}
.bg-purple-light {
background: #e5e9f2;
}
.grid-content {
border-radius: 4px;
padding: 0 4px;
float:left;
width: 50%;
.title {
font-size: 20px;
text-align: center;
@ -63,18 +96,17 @@ export default {
justify-content: center ;
}
.content {
width: 100%;
justify-content: center ;
font-size: 16px;
color: #393636;
font-family: 'Microsoft YaHei UI', 'Microsoft YaHei', DengXian, SimSun, 'Segoe UI', Tahoma, Helvetica, sans-serif;
width: 100%;
justify-content: center ;
font-size: 16px;
color: #393636;
font-family: 'Microsoft YaHei UI', 'Microsoft YaHei', DengXian, SimSun, 'Segoe UI', Tahoma, Helvetica, sans-serif;
}
}
.newsinfo-right{
padding: 0 4px;
float: left;
width: 50%;
}
.row-bg {
padding: 10px 0;
background-color: #f9fafc;
}
</style>

@ -25,10 +25,10 @@
style="width: 240px"
>
<el-option
v-for="dict in ['分类1','分类2']"
:key="dict"
:label="dict"
:value="dict"
v-for="dict in this.categoryList"
:key="dict.id"
:label="dict.name"
:value="dict.id"
/>
</el-select>
</el-form-item>
@ -40,10 +40,10 @@
style="width: 240px"
>
<el-option
v-for="dict in ['已分析','未分析']"
:key="dict"
:label="dict"
:value="dict"
v-for="dict in this.statusList"
:key="dict.id"
:label="dict.name"
:value="dict.id"
/>
</el-select>
</el-form-item>
@ -110,9 +110,10 @@
</template>
</el-table-column>
<el-table-column label="分类" align="center" prop="cateId" width="55">
<el-table-column label="分类" align="center" prop="cateName" width="80" >
<template slot-scope="scope">
<span>新闻</span>
<span v-if="scope.row.cateName!=null">{{scope.row.cateName}}</span>
<span v-else="">未分类</span>
</template>
</el-table-column>
<el-table-column label="时间" align="center" prop="createTime" width="150">
@ -174,8 +175,15 @@
<el-form-item label="评分" prop="score">
<el-input v-model="form.score" placeholder="请输入评分" />
</el-form-item>
<el-form-item label="分类" prop="cateId">
<el-input v-model="form.cateId" placeholder="请输入分类" />
<treeselect v-model="form.cateId" :options="categoryOptions" :normalizer="normalizer" placeholder="请选择父类" />
</el-form-item>
<el-form-item label="热门" prop="disabled">
<el-input v-model="form.hot" placeholder="请输入是否热门0不开启1开启" />
</el-form-item>
<el-form-item label="推荐" prop="disabled">
<el-input v-model="form.recommend" placeholder="请输入是否推荐0不推荐1推荐" />
</el-form-item>
<el-form-item label="是否禁用" prop="disabled">
<el-input v-model="form.disabled" placeholder="请输入是否禁用0启用1禁用" />
@ -194,9 +202,14 @@
<script>
import { listDocInfo, getDocInfo, delDocInfo, addDocInfo, updateDocInfo } from "@/api/biemo/docInfo";
import {listCategory} from "@/api/biemo/category";
import Treeselect from "@riophae/vue-treeselect";
import "@riophae/vue-treeselect/dist/vue-treeselect.css"
export default {
name: "DocInfo",
components: {
Treeselect
},
data() {
return {
//
@ -217,6 +230,10 @@ export default {
title: "",
//
open: false,
//
categoryOptions:[],
categoryList:[],
statusList:[{id:0,name:'未分析'},{id:1,name:'已分析'}],
//
queryParams: {
pageNum: 1,
@ -229,6 +246,8 @@ export default {
source: null,
score: null,
cateId: null,
hot: null,
recommend: null,
disabled: null,
deleted: null,
createdBy: null,
@ -247,6 +266,7 @@ export default {
};
},
created() {
this.getCategoryList();
this.getList();
},
methods: {
@ -259,6 +279,31 @@ export default {
this.loading = false;
});
},
getCategoryList(){
listCategory().then(response => {
this.categoryList = response.rows
});
},
/** 查询分类管理下拉树结构 */
getTreeselect() {
listCategory().then(response => {
this.categoryOptions = [];
const data = { id: 0, name: '顶级节点', children: [] };
data.children = this.handleTree(response.rows, "id");
this.categoryOptions.push(data);
});
},
/** 转换分类管理数据结构 */
normalizer(node) {
if (node.children && !node.children.length) {
delete node.children;
}
return {
id: node.id,
label: node.name,
children: node.children
};
},
//
cancel() {
this.open = false;
@ -287,7 +332,9 @@ export default {
updateTime: null,
parserGraphData: null,
parserNamedEntity: null,
parserEmotion: null
parserEmotion: null,
hot: null,
recommend: null
};
this.resetForm("form");
},
@ -310,12 +357,18 @@ export default {
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.getTreeselect();
this.form.cateId = 0;
this.open = true;
this.title = "添加文章管理";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
this.getTreeselect();
if (row != null) {
this.form.cateId = row.cateId;
}
const id = row.id || this.ids
getDocInfo(id).then(response => {
this.form = response.data;
@ -362,7 +415,11 @@ export default {
this.download('biemo/docInfo/export', {
...this.queryParams
}, `docInfo_${new Date().getTime()}.xlsx`)
},
handleAnalysis(){
}
}
};
</script>

@ -1,6 +1,5 @@
<template>
<div class="neo4jd3" ref="neo4jd3"></div>
<div :style="{height: chartHeight}" id="neo4jd3"></div>
<div id="neo4jd3"></div>
</template>
<script>
import Neo4jd3 from "@/views/neo4jd3/js/neo4jd3";
@ -9,12 +8,11 @@ import {getDocInfoAnalysis} from '@/api/biemo/docInfo'
export default {
name: 'neo4jd3',
props: ["id"],
data() {
return {
chartHeight: 0,
docInfo: {
nodes: [],
relationships: []
graphData: {
},
isFullscreen: false,
neo4jContent: null
@ -22,7 +20,7 @@ export default {
},
async mounted() {
this.initHeight()
await this.getData()
await this.getData(this.id)
window.onresize = () => {
if (!document.webkitFullscreenElement)
this.initHeight()
@ -31,7 +29,6 @@ export default {
},
methods: {
initHeight() {
this.chartHeight = window.innerHeight - document.querySelector('.main-header').offsetHeight - 40 + 'px'
},
screen() {
this.isFullscreen = true
@ -40,26 +37,16 @@ export default {
this.chartHeight = window.innerHeight + 'px'
}, 50)
},
async getData() {
let res = await getDocInfoAnalysis()
this.docInfo = res.data
async getData(id) {
let res = await getDocInfoAnalysis(id)
this.graphData = res.data
this.init()
},
init() {
let nodes = this.docInfo.nodes.map(node => this.transformNode(node))
let relationships = this.docInfo.relationships.map(relation => this.transformNode(relation))
let images = {}
icons.forEach(icon => {
if (!images[icon]) images[icon] = `ontology/${icon}.png`
})
let neo4jData = {
results: [{
data: [{
nodes: nodes,
relationships
}]
}]
}
var neo4jd3 = new Neo4jd3('#neo4jd3', {
highlight: [
{
@ -77,8 +64,8 @@ export default {
},
images,
minCollision: 60,
neo4jData: neo4jData,
//neo4jDataUrl: '/dev-api/common/download/resource?resource=/profile/neo4jData.json',
//neo4jDataUrl: '/dev-api/common/download/resource?resource=/profile/my.json',
neo4jData: this.graphData,
nodeRadius: 25,
onNodeDoubleClick: function (node) {
},
@ -96,9 +83,10 @@ export default {
<style rel="stylesheet/scss" lang="scss">
@import './css/neo4jd3.css';
.neo4jd3 {
#neo4jd3 {
position: relative;
background: #fff;
height: 700px;
.refresh-button {
position: absolute;

Loading…
Cancel
Save