1989c6a8 by lihua

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

1 parent f9fd4f11
...@@ -24,7 +24,7 @@ const props = defineProps({ ...@@ -24,7 +24,7 @@ const props = defineProps({
24 type: Object, 24 type: Object,
25 default: {} 25 default: {}
26 }, 26 },
27 noContextMenu: { 27 noContextMenu: { //关系查看页面,显示右键菜单定位到详情。标准查询页面,显示引用标准新建数据集
28 type: Boolean, 28 type: Boolean,
29 default: false 29 default: false
30 } 30 }
...@@ -194,17 +194,28 @@ const initGraph = () => { ...@@ -194,17 +194,28 @@ const initGraph = () => {
194 getContent(evt: any) { 194 getContent(evt: any) {
195 const { item, target } = evt; 195 const { item, target } = evt;
196 let model = item._cfg.model; 196 let model = item._cfg.model;
197 return ` 197 if (props.noContextMenu) {
198 return `
199 <div class='context-menu'>
200 <span class='menu-item'>查看标准管理</span>
201 </div>`
202 } else {
203 return `
198 <div class='context-menu'> 204 <div class='context-menu'>
199 <span class='menu-item'>引用标准新建数据集</span> 205 <span class='menu-item'>引用标准新建数据集</span>
200 </div>` 206 </div>`
207 }
201 }, 208 },
202 shouldBegin: (evt: any) => { 209 shouldBegin: (evt: any) => {
210 const { item, target } = evt;
211 let model = item._cfg.model;
203 if (props.noContextMenu) { 212 if (props.noContextMenu) {
204 return false; 213 return false;
214 if (model && !model.isField) {
215 return true;
216 }
217 return false;
205 } 218 }
206 const { item, target } = evt;
207 let model = item._cfg.model;
208 if (model && !model.isField && !model.children?.length) { 219 if (model && !model.isField && !model.children?.length) {
209 return true; 220 return true;
210 } 221 }
...@@ -487,17 +498,24 @@ const bindEvents = () => { ...@@ -487,17 +498,24 @@ const bindEvents = () => {
487 detailInfo.value = {}; 498 detailInfo.value = {};
488 // detailInfo.value.guid = model.guid; 499 // detailInfo.value.guid = model.guid;
489 detailInfoLabel.value = model.metaStandardId || {}; 500 detailInfoLabel.value = model.metaStandardId || {};
490 updateTooltipPosition(evt);
491
492 detailLoading.value = true; 501 detailLoading.value = true;
493 getMetaStandardFieldDetail(model.guid).then((res: any) => { 502 nextTick(() => {
494 if (res?.code == proxy.$passCode) { 503 tooltip1Ref.value.style.display = 'block';
495 detailInfo.value = res.data?.metaStandardValue || {}; 504 updateTooltipPosition(evt);
496 detailInfoLabel.value = model.metaStandardId; 505 getMetaStandardFieldDetail(model.guid).then((res: any) => {
497 detailLoading.value = false; 506
498 } else { 507 if (res?.code == proxy.$passCode) {
499 ElMessage.error(res.msg); 508 detailInfo.value = res.data?.metaStandardValue || {};
500 } 509 detailInfoLabel.value = model.metaStandardId;
510 detailLoading.value = false;
511 nextTick(() => {
512 tooltip1Ref.value.style.display = 'block';
513 updateTooltipPosition(evt);
514 })
515 } else {
516 ElMessage.error(res.msg);
517 }
518 })
501 }) 519 })
502 return; 520 return;
503 } 521 }
...@@ -586,6 +604,7 @@ defineExpose({ ...@@ -586,6 +604,7 @@ defineExpose({
586 width: 100%; 604 width: 100%;
587 height: 100%; 605 height: 100%;
588 position: relative; 606 position: relative;
607 overflow: hidden;
589 } 608 }
590 609
591 .canvas-wrapper:-webkit-full-screen { 610 .canvas-wrapper:-webkit-full-screen {
......
...@@ -54,11 +54,14 @@ const getTreeData = async () => { ...@@ -54,11 +54,14 @@ const getTreeData = async () => {
54 treeInfo.value.loading = false; 54 treeInfo.value.loading = false;
55 if (res?.code == proxy.$passCode) { 55 if (res?.code == proxy.$passCode) {
56 const data = res.data || []; 56 const data = res.data || [];
57 data.forEach(d => {
58 d.disabled = true;
59 })
57 treeInfo.value.data = data; 60 treeInfo.value.data = data;
58 if (data.length) { 61 if (data.length) {
59 treeInfo.value.currentNodeKey = data[0].guid; 62 treeInfo.value.currentNodeKey = data[0]?.children?.[0]?.guid;
60 treeInfo.value.expandedKey = <any>[data[0].guid]; 63 treeInfo.value.expandedKey = <any>[data[0].guid];
61 nodeClick(treeInfo.value.data[0]) 64 nodeClick(treeInfo.value.data[0]?.children?.[0])
62 } 65 }
63 } else { 66 } else {
64 ElMessage.error(res.msg); 67 ElMessage.error(res.msg);
...@@ -79,6 +82,14 @@ const nodeClick = (data) => { ...@@ -79,6 +82,14 @@ const nodeClick = (data) => {
79 if (ele) { 82 if (ele) {
80 ele.style.display = "none" 83 ele.style.display = "none"
81 } 84 }
85 if (data.disabled) {
86 treeInfo.value.currentNodeKey = data.guid;
87 nextTick(() => {
88 treeInfo.value.currentNodeKey = lastClickNode.value.guid;
89 });
90 // lastClickNode.value = {};
91 return;
92 }
82 treeInfo.value.currentNodeKey = data.guid; 93 treeInfo.value.currentNodeKey = data.guid;
83 treeInfo.value.expandedKey = <any>[data.guid]; 94 treeInfo.value.expandedKey = <any>[data.guid];
84 lastClickNode.value = cloneDeep(data); 95 lastClickNode.value = cloneDeep(data);
...@@ -205,8 +216,8 @@ const handleNodeItemClick = (graph, nodeItem) => { ...@@ -205,8 +216,8 @@ const handleNodeItemClick = (graph, nodeItem) => {
205 graph.setMinZoom(0.5); 216 graph.setMinZoom(0.5);
206 graph.setMaxZoom(5); 217 graph.setMaxZoom(5);
207 graph.focusItem(nodeItem, true, { 218 graph.focusItem(nodeItem, true, {
208 duration: 500 // 动画时长为500ms 219 duration: 500 // 动画时长为500ms
209 }); 220 });
210 }, 500); 221 }, 500);
211 } else { 222 } else {
212 parentData.isLoading = false; 223 parentData.isLoading = false;
...@@ -349,7 +360,7 @@ const dialogBtnClick = (btn, info) => { ...@@ -349,7 +360,7 @@ const dialogBtnClick = (btn, info) => {
349 <Tree ref="treeInfoRef" :treeInfo="treeInfo" @nodeClick="nodeClick" /> 360 <Tree ref="treeInfoRef" :treeInfo="treeInfo" @nodeClick="nodeClick" />
350 </div> 361 </div>
351 <div class="main_wrap"> 362 <div class="main_wrap">
352 <div className='g6-component-topbar'> 363 <div v-show="lastClickNode?.guid" className='g6-component-topbar'>
353 <graphTopbar ref="topBarRef" @displaySwitchChange="displaySwitchChange" :isGraphDisplay="isGraphDisplay" /> 364 <graphTopbar ref="topBarRef" @displaySwitchChange="displaySwitchChange" :isGraphDisplay="isGraphDisplay" />
354 </div> 365 </div>
355 <RelationNetwork v-show="lastClickNode?.guid && isGraphDisplay" ref="relationNetworkRef" 366 <RelationNetwork v-show="lastClickNode?.guid && isGraphDisplay" ref="relationNetworkRef"
...@@ -360,10 +371,10 @@ const dialogBtnClick = (btn, info) => { ...@@ -360,10 +371,10 @@ const dialogBtnClick = (btn, info) => {
360 v-loading="sankeyDataLoading" :tree-data="sankeyData" :names="sankeyNames"> 371 v-loading="sankeyDataLoading" :tree-data="sankeyData" :names="sankeyNames">
361 </Sankey> 372 </Sankey>
362 <div 373 <div
363 v-show="!lastClickNode?.guid && !treeInfo.data?.length || (!isGraphDisplay && !sankeyDataLoading && !sankeyNames?.length)" 374 v-show="(!lastClickNode?.guid || !treeInfo.data?.length) && !treeInfo.loading || (!isGraphDisplay && !sankeyDataLoading && !sankeyNames?.length)"
364 class="main-placeholder"> 375 class="main-placeholder">
365 <img src="../../assets/images/no-data.png" :style="{ width: '96px', height: '96px' }" /> 376 <img src="../../assets/images/no-data.png" :style="{ width: '96px', height: '96px' }" />
366 <div class="empty-text">暂无数据</div> 377 <div class="empty-text">{{ treeInfo.data.length && !lastClickNode?.guid ? '请选中二级及以下级别标准查看' : '暂无数据' }}</div>
367 </div> 378 </div>
368 </div> 379 </div>
369 <Dialog :dialogInfo="dialogInfo" @btnClick="dialogBtnClick" @treeSelectNodeChange="handleTreeSelectNodeChange" /> 380 <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!