SocialNetworks_duan/src/views/LinkPrediction/socialGroups/components/graph.vue

75 lines
2.1 KiB
Vue
Raw Normal View History

2025-07-29 12:13:55 +08:00
<template>
<div class="graph-component">
<img :src="title" alt="" class="title" />
<CommunityNode
2025-07-29 16:25:28 +08:00
v-if="socialGroupsStore.curComponent == 'CommunityNode'"
2025-07-29 12:13:55 +08:00
@click:node="handleClickNode"
@click:edge="handleClickEdge"
></CommunityNode>
<DetailNode
v-else
@click:goback="handleClickGoBack"
2025-08-01 14:26:12 +08:00
@click:openDialog="handleClickOpenDialog"
2025-07-29 12:13:55 +08:00
></DetailNode>
</div>
</template>
<script setup>
import CommunityNode from "./communityNode.vue"
import DetailNode from "./detailNode.vue"
import { useSocialGroupsStore } from "@/store/linkPrediction/index"
2025-07-29 12:13:55 +08:00
const socialGroupsStore = useSocialGroupsStore()
const props = defineProps({
title: {
type: String,
default: ""
}
})
2025-08-01 14:26:12 +08:00
const emit = defineEmits(["click:openUserInfoDialog"])
const handleClickOpenDialog = (userInfo) => {
if (userInfo) {
emit("click:openUserInfoDialog", { userInfoDialog: true, curSelectedUser: userInfo })
2025-08-01 14:26:12 +08:00
}
}
2025-07-29 12:13:55 +08:00
const handleClickNode = async (nodeInfo) => {
2025-07-29 16:25:28 +08:00
// 点击节点
socialGroupsStore.initGraphCommunityDetailNode([nodeInfo.id])
socialGroupsStore.curComponent = "detailNode"
2025-07-31 13:42:51 +08:00
socialGroupsStore.curRelationId = ""
2025-07-29 12:13:55 +08:00
}
2025-07-31 17:06:11 +08:00
const handleClickEdge = async (edgeInfo, groupIdList) => {
2025-07-29 16:25:28 +08:00
socialGroupsStore.curComponent = "detailNode"
2025-07-31 10:10:03 +08:00
socialGroupsStore.clickEvent = "edge"
2025-07-31 13:42:51 +08:00
socialGroupsStore.curRelationId = ""
2025-07-30 11:28:22 +08:00
// 先设置socialGroupsStore.clickEdgeTimeList
2025-07-31 17:06:11 +08:00
// await socialGroupsStore.getClickEdgeTimeList([edgeInfo.source, edgeInfo.target])
await socialGroupsStore.getClickEdgeTimeList(groupIdList)
2025-07-31 10:10:03 +08:00
const lastTime = socialGroupsStore.timeList[socialGroupsStore.timeList.length - 1]
2025-07-31 17:06:11 +08:00
// await socialGroupsStore.initGraphCommunityDetailNode([edgeInfo.source, edgeInfo.target], lastTime)
await socialGroupsStore.initGraphCommunityDetailNode(groupIdList, lastTime)
2025-07-29 12:13:55 +08:00
}
const handleClickGoBack = (currentComponentName) => {
2025-07-29 16:25:28 +08:00
socialGroupsStore.curComponent = currentComponentName
2025-08-18 16:35:31 +08:00
socialGroupsStore.initGraphCommunityNode()
2025-07-29 12:13:55 +08:00
}
</script>
2025-08-19 11:23:46 +08:00
<style scoped lang="scss">
2025-07-29 12:13:55 +08:00
.graph-component {
width: 100%;
height: 100%;
position: relative;
.title {
margin: 0 auto;
}
.graph-container {
width: 100%;
height: 93%;
}
}
</style>