1989c6a8 by lihua

根节点不显示关系网;提示信息位置不对

1 parent f9fd4f11
......@@ -24,7 +24,7 @@ const props = defineProps({
type: Object,
default: {}
},
noContextMenu: {
noContextMenu: { //关系查看页面,显示右键菜单定位到详情。标准查询页面,显示引用标准新建数据集
type: Boolean,
default: false
}
......@@ -194,17 +194,28 @@ const initGraph = () => {
getContent(evt: any) {
const { item, target } = evt;
let model = item._cfg.model;
return `
if (props.noContextMenu) {
return `
<div class='context-menu'>
<span class='menu-item'>查看标准管理</span>
</div>`
} else {
return `
<div class='context-menu'>
<span class='menu-item'>引用标准新建数据集</span>
</div>`
}
},
shouldBegin: (evt: any) => {
const { item, target } = evt;
let model = item._cfg.model;
if (props.noContextMenu) {
return false;
if (model && !model.isField) {
return true;
}
return false;
}
const { item, target } = evt;
let model = item._cfg.model;
if (model && !model.isField && !model.children?.length) {
return true;
}
......@@ -487,17 +498,24 @@ const bindEvents = () => {
detailInfo.value = {};
// detailInfo.value.guid = model.guid;
detailInfoLabel.value = model.metaStandardId || {};
updateTooltipPosition(evt);
detailLoading.value = true;
getMetaStandardFieldDetail(model.guid).then((res: any) => {
if (res?.code == proxy.$passCode) {
detailInfo.value = res.data?.metaStandardValue || {};
detailInfoLabel.value = model.metaStandardId;
detailLoading.value = false;
} else {
ElMessage.error(res.msg);
}
nextTick(() => {
tooltip1Ref.value.style.display = 'block';
updateTooltipPosition(evt);
getMetaStandardFieldDetail(model.guid).then((res: any) => {
if (res?.code == proxy.$passCode) {
detailInfo.value = res.data?.metaStandardValue || {};
detailInfoLabel.value = model.metaStandardId;
detailLoading.value = false;
nextTick(() => {
tooltip1Ref.value.style.display = 'block';
updateTooltipPosition(evt);
})
} else {
ElMessage.error(res.msg);
}
})
})
return;
}
......@@ -586,6 +604,7 @@ defineExpose({
width: 100%;
height: 100%;
position: relative;
overflow: hidden;
}
.canvas-wrapper:-webkit-full-screen {
......
......@@ -54,11 +54,14 @@ const getTreeData = async () => {
treeInfo.value.loading = false;
if (res?.code == proxy.$passCode) {
const data = res.data || [];
data.forEach(d => {
d.disabled = true;
})
treeInfo.value.data = data;
if (data.length) {
treeInfo.value.currentNodeKey = data[0].guid;
treeInfo.value.currentNodeKey = data[0]?.children?.[0]?.guid;
treeInfo.value.expandedKey = <any>[data[0].guid];
nodeClick(treeInfo.value.data[0])
nodeClick(treeInfo.value.data[0]?.children?.[0])
}
} else {
ElMessage.error(res.msg);
......@@ -79,6 +82,14 @@ const nodeClick = (data) => {
if (ele) {
ele.style.display = "none"
}
if (data.disabled) {
treeInfo.value.currentNodeKey = data.guid;
nextTick(() => {
treeInfo.value.currentNodeKey = lastClickNode.value.guid;
});
// lastClickNode.value = {};
return;
}
treeInfo.value.currentNodeKey = data.guid;
treeInfo.value.expandedKey = <any>[data.guid];
lastClickNode.value = cloneDeep(data);
......@@ -205,8 +216,8 @@ const handleNodeItemClick = (graph, nodeItem) => {
graph.setMinZoom(0.5);
graph.setMaxZoom(5);
graph.focusItem(nodeItem, true, {
duration: 500 // 动画时长为500ms
});
duration: 500 // 动画时长为500ms
});
}, 500);
} else {
parentData.isLoading = false;
......@@ -349,7 +360,7 @@ const dialogBtnClick = (btn, info) => {
<Tree ref="treeInfoRef" :treeInfo="treeInfo" @nodeClick="nodeClick" />
</div>
<div class="main_wrap">
<div className='g6-component-topbar'>
<div v-show="lastClickNode?.guid" className='g6-component-topbar'>
<graphTopbar ref="topBarRef" @displaySwitchChange="displaySwitchChange" :isGraphDisplay="isGraphDisplay" />
</div>
<RelationNetwork v-show="lastClickNode?.guid && isGraphDisplay" ref="relationNetworkRef"
......@@ -360,10 +371,10 @@ const dialogBtnClick = (btn, info) => {
v-loading="sankeyDataLoading" :tree-data="sankeyData" :names="sankeyNames">
</Sankey>
<div
v-show="!lastClickNode?.guid && !treeInfo.data?.length || (!isGraphDisplay && !sankeyDataLoading && !sankeyNames?.length)"
v-show="(!lastClickNode?.guid || !treeInfo.data?.length) && !treeInfo.loading || (!isGraphDisplay && !sankeyDataLoading && !sankeyNames?.length)"
class="main-placeholder">
<img src="../../assets/images/no-data.png" :style="{ width: '96px', height: '96px' }" />
<div class="empty-text">暂无数据</div>
<div class="empty-text">{{ treeInfo.data.length && !lastClickNode?.guid ? '请选中二级及以下级别标准查看' : '暂无数据' }}</div>
</div>
</div>
<Dialog :dialogInfo="dialogInfo" @btnClick="dialogBtnClick" @treeSelectNodeChange="handleTreeSelectNodeChange" />
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!