d1d278cc by lihua

调整关系网字段间距

1 parent 59b883fe
......@@ -4,7 +4,7 @@
<div class="title">{{ detailInfoLabel }}</div>
<div class="row" v-for="item in Object.keys(detailInfo)">
<span>{{ item + ':' }}</span>
<span>{{ detailInfo[item] == null ? '-' : detailInfo[item] }}</span>
<span>{{ detailInfo[item] == null || detailInfo[item] == '' ? '-' : detailInfo[item] }}</span>
</div>
</div>
</div>
......@@ -37,7 +37,7 @@ const emits = defineEmits([
const { proxy } = getCurrentInstance() as any;
const maxChineseCount = ref(14);
const maxChineseCount = ref(16);
const maxEnglishCount = ref(26);
......@@ -122,7 +122,9 @@ const handleLabelLength = (label: string) => {
if (detectLanguage(label) == 'English') {
return label?.length > maxEnglishCount.value ? label.slice(0, maxEnglishCount.value) + '...' : label;
}
return label?.length > maxChineseCount.value ? label.slice(0, maxChineseCount.value) + '...' : label;
let arr = label.split('\n');
let maxLen = Math.max(...arr.map(s => s.length));
return maxLen > maxChineseCount.value ? label.slice(0, maxChineseCount.value) + '...' : label;
};
insertCss(`
......@@ -167,7 +169,9 @@ const initGraph = () => {
if (detectLanguage(name) == 'English') {
return name?.length > maxEnglishCount.value;
}
return name?.length > maxChineseCount.value;
let arr = name.split('\n');
let maxLen = Math.max(...arr.map(s => s.length));
return maxLen > maxChineseCount.value;
}
return false;
},
......@@ -178,7 +182,7 @@ const initGraph = () => {
const outDiv = document.createElement('div');
outDiv.className = 'node';
outDiv.style.width = 'fit-content';
const name = item._cfg.model.label;
const name = item._cfg.model.isField ? item._cfg.model.metaStandardId : item._cfg.model.standardName;
if (currentAnchor == 'text-shape') {
outDiv.innerHTML = `<h4>${name}</h4>`
}
......@@ -265,7 +269,7 @@ const initGraph = () => {
],
},
defaultNode: {
size: 20,
size: 16,
anchorPoints: [
[0, 0.5],
[1, 0.5],
......@@ -291,8 +295,11 @@ const initGraph = () => {
getWidth: function getWidth() {
return 16;
},
getVGap: function getVGap() {
return 15;
getVGap: function getVGap(node) {
if (node.isField) {
return 6;
}
return 20;
},
getHGap: function getHGap() {
return 120;
......@@ -479,14 +486,14 @@ const bindEvents = () => {
lastSelectNode.value = item;
detailInfo.value = {};
// detailInfo.value.guid = model.guid;
detailInfoLabel.value = model.label || {};
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.label;
detailInfoLabel.value = model.metaStandardId;
detailLoading.value = false;
} else {
ElMessage.error(res.msg);
......@@ -618,7 +625,7 @@ defineExpose({
font-size: 12px;
color: #666666;
word-break: break-all;
line-height: 21px;
line-height: 18px;
}
}
</style>
\ No newline at end of file
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!