| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208 |
- <template>
- <Transition name="entity-drawer">
- <aside v-if="store.open" class="entity-drawer" :class="`is-${side}`" role="dialog" aria-modal="false" aria-label="实体详情" data-entity-detail-drawer>
- <header class="entity-drawer__head">
- <div class="entity-drawer__heading">
- <span class="entity-drawer__eyebrow">{{ view.subtitle || '实体详情' }}</span>
- <h2>{{ view.title }}</h2>
- </div>
- <button type="button" class="entity-drawer__close" aria-label="关闭详情" @click="store.close">×</button>
- </header>
- <!-- 维护者 2026-10-29:等级不在这里重复 —— 它作为带色的指标卡出现在摘要区。 -->
- <div v-if="view.status || view.categoryText" class="entity-drawer__badges">
- <span v-if="view.categoryText" class="entity-drawer__badge" data-entity-category>{{ view.categoryText }}</span>
- <!-- 防护目标的「状态」就是风险等级:抬头写「风险等级」,颜色跟 risk_color,文字始终可读。 -->
- <span v-if="view.status" class="entity-drawer__badge entity-drawer__status" :data-tone="view.tone" data-entity-status>
- <em v-if="view.statusCaption" class="entity-drawer__status-caption">{{ view.statusCaption }}</em>{{ view.status }}
- </span>
- <!-- 等级/优先级与状态并排:状态定位置,等级给风险语义。 -->
- <span v-if="view.levelLabel" class="entity-drawer__badge entity-drawer__level" :data-tone="view.levelTone" data-entity-level>{{ view.levelLabel }}</span>
- </div>
- <p v-if="store.loading" class="entity-drawer__hint" data-entity-detail-loading>正在更新详情…</p>
- <p v-if="store.error" class="entity-drawer__hint is-error" data-entity-detail-error>
- 详情暂未取到,已保留列表摘要。
- <button type="button" @click="store.retry">重试</button>
- </p>
- <div class="entity-drawer__body"><EntityDetailSections :detail="store.detail" @locate-device="(code) => emit('locate-device', code)" @focus-network="(code) => emit('focus-network', code)" /></div>
- </aside>
- </Transition>
- </template>
- <script setup>
- import { computed } from 'vue'
- import { entityDetailView } from '../domain/entityDetail.js'
- import { useEntityDetailStore } from '../stores/entityDetailStore.js'
- import EntityDetailSections from './EntityDetailSections.vue'
- defineProps({ side: { type: String, default: 'right' } })
- const emit = defineEmits(['locate-device', 'focus-network'])
- const store = useEntityDetailStore()
- const view = computed(() => entityDetailView(store.detail))
- </script>
- <style scoped>
- .entity-drawer,
- .entity-drawer * {
- box-sizing: border-box;
- }
- /* 与两侧业务面板同一套磨砂语言(CockpitPanel):同一组 token + 同样的 blur/saturate。
- 尺寸/位置仍由外壳决定(只贴来源侧、只占一张图),这里只管"看起来像同一套面板"。 */
- .entity-drawer {
- position: absolute;
- z-index: 42;
- top: calc(12 * var(--u, 1px));
- bottom: calc(12 * var(--u, 1px));
- width: min(calc(360 * var(--u, 1px)), 42%);
- display: grid;
- grid-template-rows: auto auto auto minmax(0, 1fr);
- gap: calc(6 * var(--u, 1px));
- padding: calc(7 * var(--u, 1px)) calc(8 * var(--u, 1px));
- border: 1px solid var(--panel-line, rgba(1, 171, 234, 0.35));
- border-radius: calc(4 * var(--u, 1px));
- background: linear-gradient(
- 180deg,
- var(--panel-top, rgba(2, 9, 27, 0.28)) 0%,
- var(--panel-mid, rgba(0, 53, 156, 0.2)) 26%,
- var(--panel-bot, rgba(0, 15, 52, 0.38)) 100%
- );
- backdrop-filter: blur(16px) saturate(115%);
- -webkit-backdrop-filter: blur(16px) saturate(115%);
- box-shadow: inset 0 1px 0 rgba(1, 171, 234, 0.14), var(--shadow, 0 18px 44px rgba(0, 0, 0, 0.55));
- color: var(--text, #d7ecff);
- }
- .entity-drawer.is-left { left: calc(var(--rail-w) + 12 * var(--u, 1px)); }
- .entity-drawer.is-right { right: calc(var(--rail-w) + 12 * var(--u, 1px)); }
- .entity-drawer__head {
- display: flex;
- align-items: flex-start;
- gap: calc(8 * var(--u, 1px));
- padding-bottom: calc(6 * var(--u, 1px));
- border-bottom: 1px solid var(--panel-line, rgba(1, 171, 234, 0.22));
- }
- .entity-drawer__heading {
- flex: 1;
- min-width: 0;
- }
- .entity-drawer__eyebrow {
- display: block;
- color: var(--cyan-hi, #35d8ff);
- font-size: var(--fs-caption, 10.5px);
- letter-spacing: 0.08em;
- }
- .entity-drawer h2 {
- margin: calc(2 * var(--u, 1px)) 0 0;
- color: var(--text-strong, #eaf6ff);
- font-size: var(--fs-body, 13px);
- line-height: 1.35;
- /* 标题/编码不截断成省略号:放不下就折行。 */
- overflow-wrap: anywhere;
- }
- .entity-drawer__close {
- width: calc(22 * var(--u, 1px));
- height: calc(22 * var(--u, 1px));
- padding: 0;
- border: 1px solid rgba(1, 171, 234, 0.35);
- border-radius: 50%;
- background: rgba(0, 20, 72, 0.5);
- color: var(--text-2, #88b7e8);
- font: inherit;
- cursor: pointer;
- }
- .entity-drawer__close:hover,
- .entity-drawer__close:focus-visible {
- border-color: var(--cyan-hi, #00b8ff);
- color: var(--text-strong, #eaf6ff);
- }
- /* 类别与状态:类别是身份(中文+英文码),状态带语义色 —— 两者都不只靠颜色区分。 */
- .entity-drawer__badges {
- display: flex;
- flex-wrap: wrap;
- gap: calc(4 * var(--u, 1px));
- justify-self: start;
- }
- .entity-drawer__level { font-weight: 700; }
- .entity-drawer__badge {
- padding: 1px calc(7 * var(--u, 1px));
- border: 1px solid rgba(1, 171, 234, 0.3);
- border-radius: calc(10 * var(--u, 1px));
- color: var(--text-2, #88b7e8);
- font-size: var(--fs-caption, 10.5px);
- }
- .entity-drawer__level[data-tone='lv1'],
- .entity-drawer__status[data-tone='lv1'] { border-color: rgba(255, 59, 82, 0.55); color: #ffc2c9; }
- .entity-drawer__level[data-tone='lv2'],
- .entity-drawer__status[data-tone='lv2'] { border-color: rgba(255, 176, 32, 0.55); color: #ffdc91; }
- .entity-drawer__level[data-tone='lv3'],
- .entity-drawer__status[data-tone='lv3'] { border-color: rgba(1, 171, 234, 0.55); color: #b7e4ff; }
- .entity-drawer__level[data-tone='lv4'],
- .entity-drawer__status[data-tone='lv4'] { border-color: rgba(53, 219, 146, 0.5); color: #b8f2d4; }
- /* 已处置=紫(与列表卡同一套状态色)、未知=中性灰;等级四档不含这两档。 */
- /* 风险颜色(risk_color 字典):红 / 橙 / 黄 / 蓝四档。文字仍是中文,颜色不是唯一线索。 */
- .entity-drawer__status[data-tone='risk-1'] { border-color: rgba(255, 59, 82, 0.6); color: #ffc2c9; background: rgba(255, 59, 82, 0.12); }
- .entity-drawer__status[data-tone='risk-2'] { border-color: rgba(255, 138, 32, 0.6); color: #ffd8a8; background: rgba(255, 138, 32, 0.12); }
- .entity-drawer__status[data-tone='risk-3'] { border-color: rgba(255, 214, 32, 0.6); color: #ffeeb0; background: rgba(255, 214, 32, 0.12); }
- .entity-drawer__status[data-tone='risk-4'] { border-color: rgba(1, 171, 234, 0.6); color: #b7e4ff; background: rgba(1, 171, 234, 0.12); }
- /* 徽标抬头(「风险等级」):小一号、弱化,不抢风险等级本身。 */
- .entity-drawer__status-caption { margin-right: 4px; font-style: normal; font-weight: 400; opacity: 0.72; }
- .entity-drawer__status[data-tone='handled'] { border-color: rgba(169, 112, 255, 0.6); color: #dcc9ff; }
- .entity-drawer__status[data-tone='neutral'] { border-color: rgba(86, 128, 176, 0.5); color: #c4d5e8; }
- .entity-drawer__hint {
- margin: 0;
- color: var(--muted, #5680b0);
- font-size: var(--fs-caption, 10.5px);
- }
- .entity-drawer__hint.is-error { color: #ffc2c9; }
- .entity-drawer__hint button {
- margin-left: calc(6 * var(--u, 1px));
- border: 0;
- background: none;
- color: var(--cyan-hi, #35d8ff);
- font: inherit;
- cursor: pointer;
- }
- .entity-drawer__body {
- min-height: 0;
- overflow-y: auto;
- overflow-x: hidden;
- padding-right: 2px;
- }
- .entity-drawer-enter-active,
- .entity-drawer-leave-active {
- transition: transform 0.18s ease, opacity 0.18s ease;
- }
- .entity-drawer-enter-from,
- .entity-drawer-leave-to {
- transform: translateX(20px);
- opacity: 0;
- }
- @media (max-width: 680px) {
- .entity-drawer,
- .entity-drawer.is-left,
- .entity-drawer.is-right {
- top: auto;
- left: 8px;
- right: 8px;
- bottom: 8px;
- width: auto;
- max-height: 72vh;
- }
- }
- </style>
|