All checks were successful
Build and Deploy Front / deploy (push) Successful in 4m4s
统一装袋/打板扫描布局,完善主从页脏数据与顶栏操作;语言收进用户菜单,艾迪浮窗精简为胶囊顶栏。 Co-authored-by: Cursor <cursoragent@cursor.com>
295 lines
5.9 KiB
Vue
295 lines
5.9 KiB
Vue
<template>
|
|
<div class="rbac-detail-shell">
|
|
<div v-if="empty" class="shell-empty">
|
|
<div class="empty-icon">
|
|
<slot name="empty-icon">
|
|
<icon-select-all />
|
|
</slot>
|
|
</div>
|
|
<p class="empty-title">{{ emptyTitle }}</p>
|
|
<p v-if="emptyDesc" class="empty-desc">{{ emptyDesc }}</p>
|
|
</div>
|
|
|
|
<template v-else>
|
|
<div class="shell-header">
|
|
<div class="header-main">
|
|
<div class="header-left">
|
|
<div v-if="$slots.icon" class="header-icon">
|
|
<slot name="icon" />
|
|
</div>
|
|
<div class="header-text">
|
|
<div class="header-title-row">
|
|
<h2 class="header-title">{{ title }}</h2>
|
|
<a-tag
|
|
v-for="tag in tags"
|
|
:key="tag.label"
|
|
:color="tag.color"
|
|
size="small"
|
|
>
|
|
{{ tag.label }}
|
|
</a-tag>
|
|
<span v-if="subtitle" class="header-subtitle">{{ subtitle }}</span>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div v-if="stats.length" class="header-stats">
|
|
<div v-for="stat in stats" :key="stat.label" class="stat-item">
|
|
<span class="stat-value">{{ stat.value }}</span>
|
|
<span class="stat-label">{{ stat.label }}</span>
|
|
</div>
|
|
</div>
|
|
<div v-if="$slots.actions" class="header-actions">
|
|
<slot name="actions" />
|
|
</div>
|
|
</div>
|
|
<div v-if="$slots['header-extra']" class="header-extra">
|
|
<slot name="header-extra" />
|
|
</div>
|
|
</div>
|
|
|
|
<div v-if="tabs.length" class="shell-tabs">
|
|
<SlidingTabs v-model="modelTab" :items="tabs" />
|
|
<div v-if="$slots['tabs-extra']" class="tabs-extra">
|
|
<slot name="tabs-extra" />
|
|
</div>
|
|
</div>
|
|
|
|
<div class="shell-body" :class="{ 'shell-body--loading': loading }">
|
|
<a-spin :loading="loading" style="width: 100%; min-height: 120px">
|
|
<slot />
|
|
</a-spin>
|
|
</div>
|
|
</template>
|
|
</div>
|
|
</template>
|
|
|
|
<script setup lang="ts">
|
|
import { computed } from 'vue'
|
|
import { IconSelectAll } from '@arco-design/web-vue/es/icon'
|
|
|
|
export interface RbacDetailTag {
|
|
label: string
|
|
color?: string
|
|
}
|
|
|
|
export interface RbacDetailStat {
|
|
label: string
|
|
value: string | number
|
|
}
|
|
|
|
export interface RbacDetailTab {
|
|
key: string
|
|
label: string
|
|
badge?: string | number
|
|
}
|
|
|
|
const props = withDefaults(
|
|
defineProps<{
|
|
empty?: boolean
|
|
emptyTitle?: string
|
|
emptyDesc?: string
|
|
title?: string
|
|
subtitle?: string
|
|
tags?: RbacDetailTag[]
|
|
stats?: RbacDetailStat[]
|
|
tabs?: RbacDetailTab[]
|
|
activeTab?: string
|
|
loading?: boolean
|
|
}>(),
|
|
{
|
|
empty: false,
|
|
emptyTitle: '请从左侧选择一项',
|
|
emptyDesc: '',
|
|
title: '',
|
|
subtitle: '',
|
|
tags: () => [],
|
|
stats: () => [],
|
|
tabs: () => [],
|
|
activeTab: '',
|
|
loading: false,
|
|
}
|
|
)
|
|
|
|
const emit = defineEmits<{ 'update:activeTab': [string] }>()
|
|
|
|
const modelTab = computed({
|
|
get: () => props.activeTab || props.tabs[0]?.key || '',
|
|
set: (v: string) => emit('update:activeTab', v),
|
|
})
|
|
</script>
|
|
|
|
<style scoped lang="less">
|
|
.rbac-detail-shell {
|
|
height: 100%;
|
|
display: flex;
|
|
flex-direction: column;
|
|
overflow: hidden;
|
|
background: var(--app-card-bg);
|
|
}
|
|
|
|
.shell-empty {
|
|
flex: 1;
|
|
display: flex;
|
|
flex-direction: column;
|
|
align-items: center;
|
|
justify-content: center;
|
|
padding: 48px 24px;
|
|
color: var(--color-text-3);
|
|
|
|
.empty-icon {
|
|
width: 72px;
|
|
height: 72px;
|
|
border-radius: 50%;
|
|
background: var(--color-fill-2);
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
font-size: 32px;
|
|
color: var(--color-text-4);
|
|
margin-bottom: 16px;
|
|
}
|
|
|
|
.empty-title {
|
|
font-size: 15px;
|
|
font-weight: 500;
|
|
color: var(--color-text-2);
|
|
margin: 0 0 8px;
|
|
}
|
|
|
|
.empty-desc {
|
|
font-size: 13px;
|
|
margin: 0;
|
|
max-width: 360px;
|
|
text-align: center;
|
|
line-height: 1.6;
|
|
}
|
|
}
|
|
|
|
.shell-header {
|
|
display: flex;
|
|
flex-direction: column;
|
|
gap: 10px;
|
|
padding: 12px 20px;
|
|
border-bottom: 1px solid var(--color-border-2);
|
|
flex-shrink: 0;
|
|
}
|
|
|
|
.header-main {
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 12px 16px;
|
|
flex-wrap: nowrap;
|
|
min-height: 32px;
|
|
}
|
|
|
|
.header-left {
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 10px;
|
|
flex: 1;
|
|
min-width: 0;
|
|
}
|
|
|
|
.header-icon {
|
|
flex-shrink: 0;
|
|
}
|
|
|
|
.header-title-row {
|
|
display: flex;
|
|
align-items: center;
|
|
flex-wrap: nowrap;
|
|
gap: 8px;
|
|
min-width: 0;
|
|
}
|
|
|
|
.header-title {
|
|
margin: 0;
|
|
font-size: 16px;
|
|
font-weight: 600;
|
|
line-height: 1.3;
|
|
color: var(--color-text-1);
|
|
white-space: nowrap;
|
|
overflow: hidden;
|
|
text-overflow: ellipsis;
|
|
}
|
|
|
|
.header-subtitle {
|
|
margin: 0;
|
|
font-size: 13px;
|
|
line-height: 1.3;
|
|
color: var(--color-text-3);
|
|
white-space: nowrap;
|
|
}
|
|
|
|
.header-extra {
|
|
width: 100%;
|
|
}
|
|
|
|
.header-stats {
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 8px;
|
|
flex-shrink: 0;
|
|
}
|
|
|
|
.stat-item {
|
|
display: inline-flex;
|
|
align-items: baseline;
|
|
gap: 4px;
|
|
padding: 4px 10px;
|
|
border-radius: 6px;
|
|
background: var(--color-fill-2);
|
|
white-space: nowrap;
|
|
|
|
.stat-value {
|
|
font-size: 14px;
|
|
font-weight: 600;
|
|
color: var(--app-primary-color, #2d8c8c);
|
|
line-height: 1.2;
|
|
}
|
|
|
|
.stat-label {
|
|
font-size: 12px;
|
|
color: var(--color-text-3);
|
|
line-height: 1.2;
|
|
}
|
|
}
|
|
|
|
.header-actions {
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 8px;
|
|
flex-shrink: 0;
|
|
}
|
|
|
|
.shell-tabs {
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: flex-start;
|
|
gap: 12px;
|
|
padding: 12px 24px;
|
|
border-bottom: 1px solid var(--color-border-2);
|
|
background: var(--color-fill-1);
|
|
flex-shrink: 0;
|
|
}
|
|
|
|
.tabs-extra {
|
|
margin-left: auto;
|
|
padding: 0;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: flex-end;
|
|
}
|
|
|
|
.shell-body {
|
|
flex: 1;
|
|
min-height: 0;
|
|
overflow: auto;
|
|
padding: 16px 24px 20px;
|
|
}
|
|
|
|
.shell-body--loading {
|
|
overflow: hidden;
|
|
}
|
|
</style>
|