图谱列表
+
新建图谱
-
- {{ m.name }}
-
+
+
+ {{ m.name }}
+
+
+
@@ -505,9 +521,24 @@ export default {
links: []
},
jsonShow: false,
- helpShow: false
+ helpShow: false,
+ graphSearchQuery: "",
+ originalName: "",
+ editingDomainId: null,
+ isAnimating: false
};
},
+ computed: {
+ filteredNodeList() {
+ if (this.graphSearchQuery) {
+ return this.pageModel.nodeList.filter(item => {
+ return item.name.toLowerCase().includes(this.graphSearchQuery.toLowerCase());
+ });
+ } else {
+ return this.pageModel.nodeList;
+ }
+ }
+ },
filters: {
labelFormat: function(value) {
let domain = value.substring(1, value.length - 1);
@@ -532,6 +563,142 @@ export default {
});
},
methods: {
+ // 搜索建议查询
+ querySearch(queryString, cb) {
+ if (!queryString || queryString.trim().length === 0) {
+ cb([]);
+ return;
+ }
+
+ if (!this.domain) {
+ cb([]);
+ return;
+ }
+
+ // 调用后端获取搜索建议
+ kgBuilderApi.getSearchSuggestions(queryString, this.domain).then(result => {
+ if (result.code === 200 && result.data) {
+ // 转换为 el-autocomplete 需要的格式
+ const suggestions = result.data.map(item => {
+ return { value: item };
+ });
+ cb(suggestions);
+ } else {
+ cb([]);
+ }
+ }).catch(() => {
+ cb([]);
+ });
+ },
+
+ // 选择建议项
+ handleSelect(item) {
+ this.nodeName = item.value;
+ this.intelligentSearch();
+ },
+
+ // 切换旋转动画
+ toggleAnimation() {
+ const kgbuilder = this.$refs.kg_builder;
+ if (kgbuilder) {
+ this.isAnimating = kgbuilder.toggleOrbitAnimation();
+ if (this.isAnimating) {
+ this.$message.success('旋转动画已启动');
+ } else {
+ this.$message.info('旋转动画已停止');
+ }
+ }
+ },
+
+ intelligentSearch() {
+ if (!this.nodeName) {
+ this.$message.warning("请输入搜索内容");
+ return;
+ }
+ const data = {
+ text: this.nodeName,
+ domain: this.domain
+ };
+ kgBuilderApi.intelligentSearch(data).then(result => {
+ if (result.code === 200) {
+ const graphData = result.data;
+ if (graphData.nodes && graphData.nodes.length > 0) {
+ this.graphData = graphData;
+ } else {
+ this.$message.info("未找到相关节点");
+ }
+ } else {
+ this.$message.error("智能搜索失败: " + result.msg);
+ }
+ }).catch(error => {
+ this.$message.error("智能搜索异常: " + error);
+ });
+ },
+ deleteGraph(item) {
+ this.$confirm(`此操作将永久删除图谱 [${item.name}] 及所有数据, 是否继续?`, "提示", {
+ confirmButtonText: "确定",
+ cancelButtonText: "取消",
+ type: "warning"
+ }).then(() => {
+ let data = { domainId: item.id };
+ kgBuilderApi.deleteDomain(data).then(result => {
+ if (result.code == 200) {
+ this.$message({
+ type: "success",
+ message: "删除成功!"
+ });
+ this.getDomain();
+ } else {
+ this.$message.error("删除失败!");
+ }
+ });
+ }).catch(() => {
+ this.$message({
+ type: "info",
+ message: "已取消删除"
+ });
+ });
+ },
+ handleDblClick(item) {
+ this.editingDomainId = item.id;
+ this.originalName = item.name;
+ this.$nextTick(() => {
+ this.$refs[`editInput-${item.id}`][0].focus();
+ });
+ },
+ handleInputBlur(item) {
+ this.updateDomainName(item);
+ },
+ handleInputEnter(item) {
+ this.updateDomainName(item);
+ },
+ updateDomainName(item) {
+ if (item.name === this.originalName) {
+ this.editingDomainId = null;
+ return;
+ }
+ const data = {
+ oldName: this.originalName,
+ newName: item.name
+ };
+ kgBuilderApi.renameDomain(data).then(result => {
+ if (result.code === 200) {
+ this.$message({
+ type: "success",
+ message: "重命名成功!"
+ });
+ this.getDomain();
+ } else {
+ this.$message.error("重命名失败!");
+ item.name = this.originalName; // 恢复原来的名称
+ }
+ this.editingDomainId = null;
+ }).catch(() => {
+ this.$message.error("重命名失败!");
+ item.name = this.originalName; // 恢复原来的名称
+ this.editingDomainId = null;
+ });
+ },
_thisKey(item) {
this._thisView = item;
},
@@ -877,8 +1044,10 @@ export default {
if (result.code == 200) {
if (result.data != null) {
_this.graphData = { nodes: [], links: [] };
- _this.graphData.nodes = result.data.node;
- _this.graphData.links = result.data.relationship;
+ if (result.data) {
+ _this.graphData.nodes = result.data.node;
+ _this.graphData.links = result.data.relationship;
+ }
}
}
});
@@ -1455,6 +1624,20 @@ ul {
border: none;
transition: background 0.3s;
}
+.search .el-autocomplete {
+ width: 100%;
+}
+.search .el-autocomplete .el-input__inner {
+ box-sizing: border-box;
+ padding-left: 15px;
+ height: 32px;
+ line-height: 32px;
+ padding-right: 40px;
+ background: transparent;
+ border-radius: 32px;
+ border: none;
+ transition: background 0.3s;
+}
.search .el-button--default {
position: absolute;
right: 1px;
diff --git a/pom.xml b/pom.xml
index 7ade7d7..db4e67e 100644
--- a/pom.xml
+++ b/pom.xml
@@ -27,12 +27,21 @@
7.2.17
3.17
2.0
-
portable-1.7.8
+
1.8.3
1.18.26
5.8.18
1.4
2.15.0
+
+
+
+ com.hankcs
+ hanlp
+ portable-${hanlp.version}
+
+
+
@@ -47,4 +56,25 @@
kgBuilder-meta
kgBuilder-pro
+
+
+
+ aliyunmaven
+ aliyun maven
+ https://maven.aliyun.com/repository/public
+
+
+
+
+
+ aliyun-plugin
+ https://maven.aliyun.com/repository/public
+
+ true
+
+
+ false
+
+
+