|
@@ -63,7 +63,13 @@
|
|
|
|
|
|
<el-table v-loading="loading" :data="entityList" @selection-change="handleSelectionChange">
|
|
<el-table v-loading="loading" :data="entityList" @selection-change="handleSelectionChange">
|
|
<el-table-column type="selection" width="55" align="center" />
|
|
<el-table-column type="selection" width="55" align="center" />
|
|
- <el-table-column label="实体名称" align="center" prop="name" />
|
|
|
|
|
|
+ <el-table-column label="实体名称" align="center" prop="name" >
|
|
|
|
+ <template slot-scope="scope">
|
|
|
|
+ <div @click="showGraphDialog(scope.row)">
|
|
|
|
+ {{ scope.row.name }}
|
|
|
|
+ </div>
|
|
|
|
+ </template>
|
|
|
|
+ </el-table-column>
|
|
<el-table-column label="实体类" align="center" prop="labels">
|
|
<el-table-column label="实体类" align="center" prop="labels">
|
|
<template slot-scope="scope">
|
|
<template slot-scope="scope">
|
|
{{ scope.row.labels.join(', ') }}
|
|
{{ scope.row.labels.join(', ') }}
|
|
@@ -112,15 +118,21 @@
|
|
<el-button @click="cancel">取 消</el-button>
|
|
<el-button @click="cancel">取 消</el-button>
|
|
</div>
|
|
</div>
|
|
</el-dialog>
|
|
</el-dialog>
|
|
|
|
+ <el-dialog :visible.sync="dialogGraphVisible" @close="closeGraphDialog" @mouseleave="closeGraphDialog" width="500px">
|
|
|
|
+ <Graph ref="charts" :chartList="chartData" :width="450" :height="450"/>
|
|
|
|
+ </el-dialog>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
</template>
|
|
|
|
|
|
<script>
|
|
<script>
|
|
import { listEntity, getEntity, delEntity, addEntity, updateEntity } from "@/api/knowledge/entity";
|
|
import { listEntity, getEntity, delEntity, addEntity, updateEntity } from "@/api/knowledge/entity";
|
|
|
|
+import { getRelationByEntityId } from '@/api/knowledge/search'
|
|
import {bit2Info} from '@/utils/validate'
|
|
import {bit2Info} from '@/utils/validate'
|
|
|
|
+import Graph from '@/components/Echarts/graph'
|
|
|
|
|
|
export default {
|
|
export default {
|
|
name: "Entity",
|
|
name: "Entity",
|
|
|
|
+ components: { Graph },
|
|
data() {
|
|
data() {
|
|
return {
|
|
return {
|
|
// 遮罩层
|
|
// 遮罩层
|
|
@@ -151,12 +163,24 @@ export default {
|
|
form: {},
|
|
form: {},
|
|
// 表单校验
|
|
// 表单校验
|
|
rules: {
|
|
rules: {
|
|
- }
|
|
|
|
|
|
+ },
|
|
|
|
+ dialogGraphVisible: false,
|
|
|
|
+ searchList: {},
|
|
|
|
+ chartData: {
|
|
|
|
+ seriesData: [],
|
|
|
|
+ linksData: [],
|
|
|
|
+ },
|
|
};
|
|
};
|
|
},
|
|
},
|
|
created() {
|
|
created() {
|
|
this.getList();
|
|
this.getList();
|
|
},
|
|
},
|
|
|
|
+ // mounted() {
|
|
|
|
+ // this.bindTableEvents();
|
|
|
|
+ // },
|
|
|
|
+ // beforeDestroy() {
|
|
|
|
+ // this.unbindTableEvents();
|
|
|
|
+ // },
|
|
methods: {
|
|
methods: {
|
|
/** 查询实体管理列表 */
|
|
/** 查询实体管理列表 */
|
|
bit2Info,
|
|
bit2Info,
|
|
@@ -250,7 +274,70 @@ export default {
|
|
this.download('knowledge/entity/export', {
|
|
this.download('knowledge/entity/export', {
|
|
...this.queryParams
|
|
...this.queryParams
|
|
}, `entity_${new Date().getTime()}.xlsx`)
|
|
}, `entity_${new Date().getTime()}.xlsx`)
|
|
- }
|
|
|
|
|
|
+ },
|
|
|
|
+ showGraphDialog(row) {
|
|
|
|
+ // 显示对话框,并设置内容
|
|
|
|
+ getRelationByEntityId(row.id).then(resp => {
|
|
|
|
+ let respData = resp.data
|
|
|
|
+ if(respData.data.length === 0){
|
|
|
|
+ this.$message({
|
|
|
|
+ message: '没有找到匹配的数据',
|
|
|
|
+ type: 'warning'
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ let seriesData = []
|
|
|
|
+ let linksData = []
|
|
|
|
+ for (let item of respData.data) {
|
|
|
|
+ seriesData.push(
|
|
|
|
+ { name: item.name }
|
|
|
|
+ )
|
|
|
|
+ }
|
|
|
|
+ for (let link of respData.links) {
|
|
|
|
+ linksData.push(
|
|
|
|
+ {
|
|
|
|
+ source: link.fromName,
|
|
|
|
+ target: link.toName,
|
|
|
|
+ label: {
|
|
|
|
+ show: true, // 是否显示line的文字
|
|
|
|
+ formatter: link.name // line的文字
|
|
|
|
+ },
|
|
|
|
+ }
|
|
|
|
+ )
|
|
|
|
+ }
|
|
|
|
+ this.chartData = {
|
|
|
|
+ seriesData,
|
|
|
|
+ linksData,
|
|
|
|
+ }
|
|
|
|
+ this.dialogGraphVisible = true;
|
|
|
|
+ })
|
|
|
|
+ },
|
|
|
|
+ closeGraphDialog() {
|
|
|
|
+ // 关闭对话框
|
|
|
|
+ this.dialogGraphVisible = false;
|
|
|
|
+ },
|
|
|
|
+ // bindTableEvents() {
|
|
|
|
+ // const tableBody = this.$el.querySelector('.el-table__body-wrapper');
|
|
|
|
+ // if (tableBody) {
|
|
|
|
+ // tableBody.addEventListener('mouseenter', this.handleMouseEnter);
|
|
|
|
+ // tableBody.addEventListener('mouseleave', this.handleMouseLeave);
|
|
|
|
+ // }
|
|
|
|
+ // },
|
|
|
|
+ // unbindTableEvents() {
|
|
|
|
+ // const tableBody = this.$el.querySelector('.el-table__body-wrapper');
|
|
|
|
+ // if (tableBody) {
|
|
|
|
+ // tableBody.removeEventListener('mouseenter', this.handleMouseEnter);
|
|
|
|
+ // tableBody.removeEventListener('mouseleave', this.handleMouseLeave);
|
|
|
|
+ // }
|
|
|
|
+ // },
|
|
|
|
+ // handleMouseEnter(event) {
|
|
|
|
+ // if (event.target.tagName === 'TD') {
|
|
|
|
+ // const firstColumnCell = event.target.parentNode.firstElementChild;
|
|
|
|
+ // this.showDialog(firstColumnCell.textContent);
|
|
|
|
+ // }
|
|
|
|
+ // },
|
|
|
|
+ // handleMouseLeave() {
|
|
|
|
+ // this.closeGraphDialog();
|
|
|
|
+ // }
|
|
}
|
|
}
|
|
};
|
|
};
|
|
</script>
|
|
</script>
|