feat(tenant): add tenant name update functionality and enhance UI
Implemented a new API endpoint for updating tenant names, allowing owners to edit tenant information directly within the UI. The frontend now supports inline editing with success and error notifications. Additionally, internationalization files have been updated to include relevant messages for the new functionality across English, Korean, Russian, and Chinese languages, ensuring a consistent user experience. Refs: #1303
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { get, post } from '@/utils/request'
|
||||
import { get, post, put } from '@/utils/request'
|
||||
import i18n from '@/i18n'
|
||||
|
||||
const t = (key: string) => i18n.global.t(key)
|
||||
@@ -70,6 +70,27 @@ export async function resetTenantApiKey(
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新租户信息(目前仅暴露租户名称编辑入口)。
|
||||
* 后端 `PUT /tenants/:id` 走 GORM 的 `Updates(tenant)`,只会写入请求体里
|
||||
* 出现的非零字段;这里只发送 `name` 就只会改名字,不会把其它字段清空。
|
||||
* 权限:owner(与 router.go 中的 g.Owner() 守卫保持一致)。
|
||||
*/
|
||||
export async function updateTenant(
|
||||
tenantId: number,
|
||||
payload: { name: string },
|
||||
): Promise<{ success: boolean; data?: TenantInfo; message?: string }> {
|
||||
try {
|
||||
const response = await put(`/api/v1/tenants/${tenantId}`, payload)
|
||||
return response as unknown as { success: boolean; data?: TenantInfo; message?: string }
|
||||
} catch (error: any) {
|
||||
return {
|
||||
success: false,
|
||||
message: error.message || t('error.tenant.updateFailed'),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 搜索租户(支持分页、关键词搜索和租户ID过滤)
|
||||
*/
|
||||
|
||||
@@ -2354,7 +2354,14 @@ export default {
|
||||
statusLabel: 'Tenant Status',
|
||||
statusDescription: 'Current operational status of the tenant',
|
||||
createdAtLabel: 'Tenant Creation Time',
|
||||
createdAtDescription: 'Time when the tenant was created'
|
||||
createdAtDescription: 'Time when the tenant was created',
|
||||
editName: 'Edit name',
|
||||
editNamePlaceholder: 'Enter the new tenant name',
|
||||
editNameConfirm: 'Save',
|
||||
editNameCancel: 'Cancel',
|
||||
editNameRequired: 'Tenant name cannot be empty',
|
||||
editNameSuccess: 'Tenant name updated',
|
||||
editNameFailed: 'Failed to update tenant name'
|
||||
},
|
||||
storage: {
|
||||
quotaLabel: 'Storage Quota',
|
||||
@@ -2508,6 +2515,7 @@ export default {
|
||||
listFailed: 'Failed to list tenants',
|
||||
searchFailed: 'Failed to search tenants',
|
||||
resetApiKeyFailed: 'Failed to reset API Key',
|
||||
updateFailed: 'Failed to update tenant information',
|
||||
},
|
||||
initialization: {
|
||||
checkFailed: 'Check failed',
|
||||
|
||||
@@ -1612,6 +1612,13 @@ export default {
|
||||
statusDescription: "테넌트의 현재 운영 상태",
|
||||
createdAtLabel: "테넌트 생성 시간",
|
||||
createdAtDescription: "테넌트가 생성된 시간",
|
||||
editName: "이름 수정",
|
||||
editNamePlaceholder: "새 테넌트 이름을 입력하세요",
|
||||
editNameConfirm: "저장",
|
||||
editNameCancel: "취소",
|
||||
editNameRequired: "테넌트 이름은 비어 있을 수 없습니다",
|
||||
editNameSuccess: "테넌트 이름이 업데이트되었습니다",
|
||||
editNameFailed: "테넌트 이름 업데이트 실패",
|
||||
},
|
||||
storage: {
|
||||
quotaLabel: "저장소 할당량",
|
||||
@@ -1765,6 +1772,7 @@ export default {
|
||||
listFailed: '테넌트 목록 조회 실패',
|
||||
searchFailed: '테넌트 검색 실패',
|
||||
resetApiKeyFailed: 'API 키 재설정 실패',
|
||||
updateFailed: '테넌트 정보 업데이트 실패',
|
||||
},
|
||||
initialization: {
|
||||
checkFailed: '검사 실패',
|
||||
|
||||
@@ -1429,7 +1429,14 @@ export default {
|
||||
statusLabel: 'Статус арендатора',
|
||||
statusDescription: 'Текущий рабочий статус арендатора',
|
||||
createdAtLabel: 'Время создания арендатора',
|
||||
createdAtDescription: 'Дата и время создания арендатора'
|
||||
createdAtDescription: 'Дата и время создания арендатора',
|
||||
editName: 'Изменить имя',
|
||||
editNamePlaceholder: 'Введите новое имя арендатора',
|
||||
editNameConfirm: 'Сохранить',
|
||||
editNameCancel: 'Отмена',
|
||||
editNameRequired: 'Имя арендатора не может быть пустым',
|
||||
editNameSuccess: 'Имя арендатора обновлено',
|
||||
editNameFailed: 'Не удалось обновить имя арендатора'
|
||||
},
|
||||
storage: {
|
||||
quotaLabel: 'Квота хранения',
|
||||
@@ -1580,7 +1587,8 @@ export default {
|
||||
tenant: {
|
||||
listFailed: 'Не удалось получить список тенантов',
|
||||
searchFailed: 'Не удалось выполнить поиск тенантов',
|
||||
resetApiKeyFailed: 'Не удалось сбросить API Key'
|
||||
resetApiKeyFailed: 'Не удалось сбросить API Key',
|
||||
updateFailed: 'Не удалось обновить информацию об арендаторе'
|
||||
},
|
||||
initialization: {
|
||||
checkFailed: 'Проверка не пройдена',
|
||||
|
||||
@@ -1592,6 +1592,13 @@ export default {
|
||||
statusDescription: "租户当前的运行状态",
|
||||
createdAtLabel: "租户创建时间",
|
||||
createdAtDescription: "租户创建的时间",
|
||||
editName: "修改名称",
|
||||
editNamePlaceholder: "请输入新的租户名称",
|
||||
editNameConfirm: "保存",
|
||||
editNameCancel: "取消",
|
||||
editNameRequired: "租户名称不能为空",
|
||||
editNameSuccess: "租户名称已更新",
|
||||
editNameFailed: "更新租户名称失败",
|
||||
},
|
||||
storage: {
|
||||
quotaLabel: "存储配额",
|
||||
@@ -1744,6 +1751,7 @@ export default {
|
||||
listFailed: "获取租户列表失败",
|
||||
searchFailed: "搜索租户失败",
|
||||
resetApiKeyFailed: "重置 API Key 失败",
|
||||
updateFailed: "更新租户信息失败",
|
||||
},
|
||||
initialization: {
|
||||
checkFailed: "检查失败",
|
||||
|
||||
@@ -40,7 +40,30 @@
|
||||
<p class="desc">{{ $t('tenant.details.nameDescription') }}</p>
|
||||
</div>
|
||||
<div class="setting-control">
|
||||
<span class="info-value">{{ tenantInfo?.name || '-' }}</span>
|
||||
<!-- 只读态:显示名称 + 编辑按钮(owner 才看得见编辑入口)。
|
||||
原地编辑取代弹窗:少一层视觉打断,与其它行的展示节奏一致。 -->
|
||||
<template v-if="!editing">
|
||||
<span class="info-value">{{ tenantInfo?.name || '-' }}</span>
|
||||
<t-button v-if="canEditTenant" theme="default" variant="text" size="small" class="edit-btn"
|
||||
@click="startEditName">
|
||||
<template #icon>
|
||||
<t-icon name="edit" />
|
||||
</template>
|
||||
{{ $t('tenant.details.editName') }}
|
||||
</t-button>
|
||||
</template>
|
||||
<!-- 编辑态:输入框 + 保存/取消。回车保存,Esc 取消。 -->
|
||||
<div v-else class="inline-edit">
|
||||
<t-input v-model="editName" :placeholder="$t('tenant.details.editNamePlaceholder')" :maxlength="64"
|
||||
:disabled="saving" autofocus class="inline-edit-input" @enter="saveTenantName"
|
||||
@keydown="onEditKeydown" />
|
||||
<t-button theme="primary" size="small" :loading="saving" :disabled="!canSubmit" @click="saveTenantName">
|
||||
{{ $t('tenant.details.editNameConfirm') }}
|
||||
</t-button>
|
||||
<t-button theme="default" variant="outline" size="small" :disabled="saving" @click="cancelEditName">
|
||||
{{ $t('tenant.details.editNameCancel') }}
|
||||
</t-button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -73,11 +96,7 @@
|
||||
<p class="desc">{{ $t('tenant.details.statusDescription') }}</p>
|
||||
</div>
|
||||
<div class="setting-control">
|
||||
<t-tag
|
||||
:theme="getStatusTheme(tenantInfo?.status)"
|
||||
variant="light"
|
||||
size="small"
|
||||
>
|
||||
<t-tag :theme="getStatusTheme(tenantInfo?.status)" variant="light" size="small">
|
||||
{{ getStatusText(tenantInfo?.status) }}
|
||||
</t-tag>
|
||||
</div>
|
||||
@@ -125,13 +144,8 @@
|
||||
<div class="setting-control">
|
||||
<div class="usage-control">
|
||||
<span class="usage-text">{{ getUsagePercentage() }}%</span>
|
||||
<t-progress
|
||||
:percentage="getUsagePercentage()"
|
||||
:show-info="false"
|
||||
size="small"
|
||||
:theme="getUsagePercentage() > 80 ? 'warning' : 'success'"
|
||||
style="flex: 1;"
|
||||
/>
|
||||
<t-progress :percentage="getUsagePercentage()" :show-info="false" size="small"
|
||||
:theme="getUsagePercentage() > 80 ? 'warning' : 'success'" style="flex: 1;" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -141,25 +155,109 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, onMounted } from 'vue'
|
||||
import { ref, computed, onMounted } from 'vue'
|
||||
import { MessagePlugin } from 'tdesign-vue-next'
|
||||
import { getCurrentUser, type TenantInfo } from '@/api/auth'
|
||||
import { updateTenant as updateTenantApi } from '@/api/tenant'
|
||||
import { useAuthStore } from '@/stores/auth'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
|
||||
const { t, locale } = useI18n()
|
||||
const authStore = useAuthStore()
|
||||
|
||||
// Reactive state
|
||||
const tenantInfo = ref<TenantInfo | null>(null)
|
||||
const loading = ref(true)
|
||||
const error = ref('')
|
||||
|
||||
// 仅 owner 可改租户名(与后端 router.go 中 g.Owner() 守卫一致;
|
||||
// 服务端始终是权限的最终裁判,这里只决定 UI 是否露出入口)。
|
||||
const canEditTenant = computed(() => authStore.hasRole('owner'))
|
||||
|
||||
// 原地编辑租户名称:editing 控制行内只读 / 编辑两种形态切换。
|
||||
// 不沿用 dialog 是因为这里只有一个字段,弹窗反而打断了配置浏览节奏。
|
||||
const editing = ref(false)
|
||||
const editName = ref('')
|
||||
const saving = ref(false)
|
||||
const editNameTrimmed = computed(() => editName.value.trim())
|
||||
// 保存按钮可点条件:非空、改了内容、不在保存中。
|
||||
// 后端 name 字段没有 uniqueIndex 也没有重名校验,所以这里不做"是否已存在"的判断;
|
||||
// 后端 service 也只在 create 时拒空,update 时不校验,保持前端兜底非空即可。
|
||||
const canSubmit = computed(
|
||||
() => !saving.value && !!editNameTrimmed.value && editNameTrimmed.value !== tenantInfo.value?.name,
|
||||
)
|
||||
|
||||
const startEditName = () => {
|
||||
editName.value = tenantInfo.value?.name || ''
|
||||
editing.value = true
|
||||
}
|
||||
|
||||
const cancelEditName = () => {
|
||||
if (saving.value) return
|
||||
editing.value = false
|
||||
editName.value = ''
|
||||
}
|
||||
|
||||
// t-input 自身不冒泡 esc,这里手动处理(与 enter 的体验对称)。
|
||||
const onEditKeydown = (_value: any, ctx: { e: KeyboardEvent }) => {
|
||||
if (ctx?.e?.key === 'Escape') {
|
||||
cancelEditName()
|
||||
}
|
||||
}
|
||||
|
||||
const saveTenantName = async () => {
|
||||
const newName = editNameTrimmed.value
|
||||
if (!newName) {
|
||||
MessagePlugin.warning(t('tenant.details.editNameRequired'))
|
||||
return
|
||||
}
|
||||
if (!tenantInfo.value?.id) return
|
||||
if (newName === tenantInfo.value.name) {
|
||||
editing.value = false
|
||||
return
|
||||
}
|
||||
|
||||
try {
|
||||
saving.value = true
|
||||
const resp = await updateTenantApi(Number(tenantInfo.value.id), { name: newName })
|
||||
if (resp.success) {
|
||||
// 本地立即回显,避免等 /auth/me 往返;同步刷新登录态里的 tenant
|
||||
// 缓存(若当前激活租户就是 home tenant,顶部租户切换器等地方也跟着更新)。
|
||||
if (tenantInfo.value) {
|
||||
tenantInfo.value = { ...tenantInfo.value, name: newName }
|
||||
}
|
||||
if (authStore.tenant && String(authStore.tenant.id) === String(tenantInfo.value?.id)) {
|
||||
authStore.setTenant({ ...authStore.tenant, name: newName })
|
||||
}
|
||||
// memberships 里的 tenant_name 是租户切换器读的字段,一并同步避免显示旧名字。
|
||||
if (authStore.memberships?.length) {
|
||||
const next = authStore.memberships.map((m) =>
|
||||
String(m.tenant_id) === String(tenantInfo.value?.id)
|
||||
? { ...m, tenant_name: newName }
|
||||
: m,
|
||||
)
|
||||
authStore.setMemberships(next)
|
||||
}
|
||||
MessagePlugin.success(t('tenant.details.editNameSuccess'))
|
||||
editing.value = false
|
||||
} else {
|
||||
MessagePlugin.error(resp.message || t('tenant.details.editNameFailed'))
|
||||
}
|
||||
} catch (err: any) {
|
||||
MessagePlugin.error(err?.message || t('tenant.details.editNameFailed'))
|
||||
} finally {
|
||||
saving.value = false
|
||||
}
|
||||
}
|
||||
|
||||
// Methods
|
||||
const loadInfo = async () => {
|
||||
try {
|
||||
loading.value = true
|
||||
error.value = ''
|
||||
|
||||
|
||||
const userResponse = await getCurrentUser()
|
||||
|
||||
|
||||
if ((userResponse as any).success && userResponse.data) {
|
||||
tenantInfo.value = userResponse.data.tenant
|
||||
} else {
|
||||
@@ -200,7 +298,7 @@ const getStatusTheme = (status: string | undefined) => {
|
||||
|
||||
const formatDate = (dateStr: string | undefined) => {
|
||||
if (!dateStr) return t('tenant.unknown')
|
||||
|
||||
|
||||
try {
|
||||
const date = new Date(dateStr)
|
||||
const formatter = new Intl.DateTimeFormat(locale.value || 'zh-CN', {
|
||||
@@ -218,11 +316,11 @@ const formatDate = (dateStr: string | undefined) => {
|
||||
|
||||
const formatBytes = (bytes: number) => {
|
||||
if (bytes === 0) return '0 B'
|
||||
|
||||
|
||||
const k = 1024
|
||||
const sizes = ['B', 'KB', 'MB', 'GB', 'TB']
|
||||
const i = Math.floor(Math.log(bytes) / Math.log(k))
|
||||
|
||||
|
||||
return parseFloat((bytes / Math.pow(k, i)).toFixed(2)) + ' ' + sizes[i]
|
||||
}
|
||||
|
||||
@@ -230,7 +328,7 @@ const getUsagePercentage = () => {
|
||||
if (!tenantInfo.value?.storage_quota || tenantInfo.value.storage_quota === 0) {
|
||||
return 0
|
||||
}
|
||||
|
||||
|
||||
const used = tenantInfo.value.storage_used || 0
|
||||
const percentage = (used / tenantInfo.value.storage_quota) * 100
|
||||
return Math.min(Math.round(percentage * 100) / 100, 100)
|
||||
@@ -324,6 +422,7 @@ onMounted(() => {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
|
||||
.info-value {
|
||||
font-size: 14px;
|
||||
@@ -331,13 +430,32 @@ onMounted(() => {
|
||||
text-align: right;
|
||||
word-break: break-word;
|
||||
}
|
||||
|
||||
.edit-btn {
|
||||
flex-shrink: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.inline-edit {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
width: 100%;
|
||||
justify-content: flex-end;
|
||||
}
|
||||
|
||||
.inline-edit-input {
|
||||
/* 行内编辑场景下输入框不能撑满整行,否则右侧两个按钮会贴边;
|
||||
给一个合理上限即可,超出走 t-input 自己的省略。 */
|
||||
max-width: 220px;
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.usage-control {
|
||||
// width: 100%;
|
||||
// display: flex;
|
||||
// align-items: center;
|
||||
// gap: 12px;
|
||||
// width: 100%;
|
||||
// display: flex;
|
||||
// align-items: center;
|
||||
// gap: 12px;
|
||||
|
||||
.usage-text {
|
||||
font-size: 14px;
|
||||
@@ -348,4 +466,3 @@ onMounted(() => {
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
|
||||
@@ -18,13 +18,13 @@
|
||||
<span class="toolbar-count">{{ $t('tenantMember.totalCount', { n: members.length }) }}</span>
|
||||
<span class="toolbar-meta-sep" aria-hidden="true" />
|
||||
<t-popup placement="bottom-start" trigger="hover" overlay-class-name="permissions-popup-overlay"
|
||||
:overlay-inner-style="{ maxWidth: 'none', width: 'auto' }">
|
||||
:overlay-inner-style="permissionsPopupInnerStyle">
|
||||
<button type="button" class="permissions-trigger-btn" :aria-label="$t('tenantMember.permissions.title')"
|
||||
:title="$t('tenantMember.permissions.iconHint')">
|
||||
<t-icon name="info-circle" size="18px" />
|
||||
</button>
|
||||
<template #content>
|
||||
<div class="permissions-compact">
|
||||
<div class="permissions-compact permissions-compact--popover">
|
||||
<div class="permissions-compact-header">
|
||||
<span class="permissions-compact-title">{{ $t('tenantMember.permissions.title') }}</span>
|
||||
<span class="permissions-compact-desc">{{ $t('tenantMember.permissions.desc') }}</span>
|
||||
@@ -51,19 +51,21 @@
|
||||
</t-popup>
|
||||
</div>
|
||||
<div class="toolbar-controls">
|
||||
<div class="toolbar-search">
|
||||
<t-input v-model="searchQuery" :placeholder="$t('tenantMember.searchPlaceholder')" clearable
|
||||
class="toolbar-search-input">
|
||||
<template #prefix-icon><t-icon name="search" /></template>
|
||||
</t-input>
|
||||
</div>
|
||||
<div class="toolbar-btn-group">
|
||||
<t-button v-if="canManage" theme="primary" @click="openAddDialog">
|
||||
{{ $t('tenantMember.add.button') }}
|
||||
</t-button>
|
||||
<t-button v-if="canLeave" theme="danger" variant="outline" @click="confirmLeaveTenant">
|
||||
{{ $t('tenantMember.leave.button') }}
|
||||
</t-button>
|
||||
<div class="toolbar-actions-bar">
|
||||
<div class="toolbar-search">
|
||||
<t-input v-model="searchQuery" size="medium" :placeholder="$t('tenantMember.searchPlaceholder')"
|
||||
clearable class="toolbar-search-input">
|
||||
<template #prefix-icon><t-icon name="search" /></template>
|
||||
</t-input>
|
||||
</div>
|
||||
<div class="toolbar-btn-group">
|
||||
<t-button v-if="canManage" theme="primary" size="medium" @click="openAddDialog">
|
||||
{{ $t('tenantMember.add.button') }}
|
||||
</t-button>
|
||||
<t-button v-if="canLeave" theme="danger" variant="outline" size="medium" @click="confirmLeaveTenant">
|
||||
{{ $t('tenantMember.leave.button') }}
|
||||
</t-button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -102,12 +104,14 @@
|
||||
</div>
|
||||
</template>
|
||||
<template #role="{ row }">
|
||||
<t-select v-if="canManage && row.user_id !== currentUserId" :model-value="row.role"
|
||||
:options="roleOptions" size="small" style="width: 130px"
|
||||
@change="(val: string) => onRoleChange(row, val)" />
|
||||
<t-tag v-else :theme="roleTagTheme(row.role)" size="medium">
|
||||
{{ $t('tenantMember.role.' + row.role) }}
|
||||
</t-tag>
|
||||
<div class="role-cell">
|
||||
<t-select v-if="canManage && row.user_id !== currentUserId" :model-value="row.role"
|
||||
class="member-role-select" :options="roleOptions" size="small"
|
||||
@change="(val: string) => onRoleChange(row, val)" />
|
||||
<t-tag v-else :theme="roleTagTheme(row.role)" size="small">
|
||||
{{ $t('tenantMember.role.' + row.role) }}
|
||||
</t-tag>
|
||||
</div>
|
||||
</template>
|
||||
<template #joined_at="{ row }">{{ formatDate(row.joined_at) }}</template>
|
||||
<template #actions="{ row }">
|
||||
@@ -241,6 +245,16 @@ import {
|
||||
const { t, locale } = useI18n()
|
||||
const authStore = useAuthStore()
|
||||
|
||||
/** 悬停层限制在视口内,内容由内部滚动 */
|
||||
const permissionsPopupInnerStyle = {
|
||||
boxSizing: 'border-box' as const,
|
||||
padding: '0',
|
||||
width: 'min(520px, calc(100vw - 24px))',
|
||||
maxWidth: 'min(520px, calc(100vw - 24px))',
|
||||
maxHeight: 'min(400px, 65vh)',
|
||||
overflow: 'hidden',
|
||||
}
|
||||
|
||||
// State
|
||||
const members = ref<TenantMember[]>([])
|
||||
const loading = ref(false)
|
||||
@@ -372,7 +386,7 @@ function roleMatrixIcon(role: TenantRole): string {
|
||||
|
||||
const columns = computed(() => [
|
||||
{ colKey: 'member', title: t('tenantMember.columns.member'), ellipsis: true, minWidth: 160 },
|
||||
{ colKey: 'role', title: t('tenantMember.columns.role'), width: 136 },
|
||||
{ colKey: 'role', title: t('tenantMember.columns.role'), width: 140 },
|
||||
{ colKey: 'joined_at', title: t('tenantMember.columns.joinedAt'), width: 154 },
|
||||
{ colKey: 'actions', title: t('tenantMember.columns.operations'), width: 88, align: 'right' },
|
||||
])
|
||||
@@ -890,10 +904,19 @@ onMounted(() => {
|
||||
}
|
||||
|
||||
.toolbar-controls {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.toolbar-actions-bar {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex-wrap: wrap;
|
||||
gap: 12px;
|
||||
align-items: center;
|
||||
gap: 10px 12px;
|
||||
padding: 8px 12px;
|
||||
background-color: var(--td-bg-color-secondarycontainer);
|
||||
border: 1px solid var(--td-component-border);
|
||||
border-radius: 8px;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.toolbar-search {
|
||||
@@ -905,20 +928,25 @@ onMounted(() => {
|
||||
.toolbar-search-input {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
&:deep(.t-input__prefix)>.t-icon {
|
||||
align-self: center;
|
||||
}
|
||||
}
|
||||
|
||||
.toolbar-btn-group {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex-wrap: wrap;
|
||||
gap: 10px;
|
||||
flex-shrink: 0;
|
||||
margin-left: auto;
|
||||
}
|
||||
|
||||
@media (max-width: 560px) {
|
||||
.toolbar-controls {
|
||||
.toolbar-actions-bar {
|
||||
flex-direction: column;
|
||||
align-items: stretch;
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
.toolbar-search {
|
||||
@@ -927,8 +955,9 @@ onMounted(() => {
|
||||
}
|
||||
|
||||
.toolbar-btn-group {
|
||||
margin-left: 0;
|
||||
justify-content: flex-end;
|
||||
flex-wrap: nowrap;
|
||||
gap: 8px;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -948,6 +977,25 @@ onMounted(() => {
|
||||
padding-top: 12px;
|
||||
padding-bottom: 12px;
|
||||
}
|
||||
|
||||
/* 角色列:下拉不要超过单元格,避免外层 overflow-x 把右边框裁没 */
|
||||
&:deep(.role-cell) {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
width: 100%;
|
||||
max-width: 100%;
|
||||
min-width: 0;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
&:deep(.member-role-select.t-select),
|
||||
&:deep(.member-role-select.t-select > .t-select__wrap) {
|
||||
flex: 1 1 auto;
|
||||
width: 100%;
|
||||
max-width: 100%;
|
||||
min-width: 0;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
}
|
||||
|
||||
.permissions-compact {
|
||||
@@ -1044,6 +1092,71 @@ onMounted(() => {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Hover 弹出层:压扁占位 + 2×2 角色块 + 内部滚动 */
|
||||
&.permissions-compact--popover {
|
||||
padding: 10px 12px;
|
||||
margin: 0;
|
||||
max-height: min(392px, calc(65vh - 8px));
|
||||
overflow-x: hidden;
|
||||
overflow-y: auto;
|
||||
|
||||
.permissions-compact-header {
|
||||
gap: 2px;
|
||||
margin-bottom: 10px;
|
||||
|
||||
.permissions-compact-title {
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.permissions-compact-desc {
|
||||
font-size: 11px;
|
||||
line-height: 1.4;
|
||||
}
|
||||
}
|
||||
|
||||
.permissions-compact-grid {
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.perm-role-block {
|
||||
padding: 8px 10px;
|
||||
border-radius: 6px;
|
||||
|
||||
.perm-role-tag {
|
||||
font-size: 12px;
|
||||
margin-bottom: 6px;
|
||||
gap: 4px;
|
||||
|
||||
.me-badge {
|
||||
font-size: 10px;
|
||||
padding: 1px 5px;
|
||||
}
|
||||
}
|
||||
|
||||
.perm-items {
|
||||
gap: 3px;
|
||||
|
||||
.perm-item {
|
||||
font-size: 11px;
|
||||
line-height: 1.35;
|
||||
gap: 4px;
|
||||
|
||||
.t-icon {
|
||||
margin-top: 1px;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 480px) {
|
||||
&.permissions-compact--popover .permissions-compact-grid {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.loading-inline,
|
||||
|
||||
Reference in New Issue
Block a user