2026-08-11 21:33:20 +08:00
|
|
|
|
<!-- 功能描述:列表以关系名称为主展示,并提供完整唯一标识的悬停查看与复制。版本:v1.0.0。 -->
|
|
|
|
|
|
<template>
|
|
|
|
|
|
<div class="relation-name-text">
|
2026-08-12 00:37:58 +08:00
|
|
|
|
<a-tooltip :content="`${identityLabel}:${identity}`">
|
2026-08-11 21:33:20 +08:00
|
|
|
|
<span class="relation-name">{{ displayName }}</span>
|
|
|
|
|
|
</a-tooltip>
|
2026-08-12 00:37:58 +08:00
|
|
|
|
<a-tooltip :content="`复制${identityLabel}`">
|
2026-08-11 21:33:20 +08:00
|
|
|
|
<button
|
|
|
|
|
|
class="copy-button"
|
|
|
|
|
|
type="button"
|
2026-08-12 00:37:58 +08:00
|
|
|
|
:aria-label="`复制${identityLabel} ${identity}`"
|
2026-08-11 21:33:20 +08:00
|
|
|
|
@click.stop="copyIdentity"
|
|
|
|
|
|
>
|
|
|
|
|
|
<icon-copy />
|
|
|
|
|
|
</button>
|
|
|
|
|
|
</a-tooltip>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
|
|
<script setup lang="ts">
|
|
|
|
|
|
import { Message } from '@arco-design/web-vue';
|
|
|
|
|
|
import { IconCopy } from '@arco-design/web-vue/es/icon';
|
|
|
|
|
|
import { computed } from 'vue';
|
|
|
|
|
|
|
2026-08-12 00:37:58 +08:00
|
|
|
|
const props = defineProps<{
|
|
|
|
|
|
name: string;
|
|
|
|
|
|
identity: string;
|
|
|
|
|
|
identityLabel?: string;
|
|
|
|
|
|
}>();
|
2026-08-11 21:33:20 +08:00
|
|
|
|
const displayName = computed(() => props.name || props.identity);
|
|
|
|
|
|
|
2026-08-12 00:37:58 +08:00
|
|
|
|
/** 复制当前关联记录的完整唯一标识,并给出明确操作反馈。 */
|
2026-08-11 21:33:20 +08:00
|
|
|
|
async function copyIdentity() {
|
|
|
|
|
|
try {
|
|
|
|
|
|
await navigator.clipboard.writeText(props.identity);
|
2026-08-12 00:37:58 +08:00
|
|
|
|
Message.success(`${props.identityLabel ?? '唯一标识'}已复制`);
|
2026-08-11 21:33:20 +08:00
|
|
|
|
} catch {
|
|
|
|
|
|
Message.error('复制失败,请从悬浮提示中复制');
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
|
|
<style scoped>
|
|
|
|
|
|
.relation-name-text {
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
gap: 6px;
|
|
|
|
|
|
align-items: center;
|
|
|
|
|
|
min-width: 0;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.relation-name {
|
|
|
|
|
|
min-width: 0;
|
|
|
|
|
|
overflow: hidden;
|
|
|
|
|
|
color: var(--color-text-1);
|
|
|
|
|
|
text-overflow: ellipsis;
|
|
|
|
|
|
white-space: nowrap;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.copy-button {
|
|
|
|
|
|
display: inline-flex;
|
|
|
|
|
|
flex: 0 0 auto;
|
|
|
|
|
|
align-items: center;
|
|
|
|
|
|
justify-content: center;
|
|
|
|
|
|
width: 24px;
|
|
|
|
|
|
height: 24px;
|
|
|
|
|
|
padding: 0;
|
|
|
|
|
|
color: rgb(var(--primary-6));
|
|
|
|
|
|
font-size: 14px;
|
|
|
|
|
|
background: transparent;
|
|
|
|
|
|
border: 0;
|
|
|
|
|
|
border-radius: 4px;
|
|
|
|
|
|
cursor: pointer;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.copy-button:hover,
|
|
|
|
|
|
.copy-button:focus-visible {
|
|
|
|
|
|
background: var(--color-fill-2);
|
|
|
|
|
|
outline: none;
|
|
|
|
|
|
}
|
|
|
|
|
|
</style>
|