Skip to content

Open-source LLM knowledge platform: turn raw documents into a queryable RAG, an autonomous reasoning agent, and a self-maintaining Wiki.

feat(tenant): enhance tenant information update with description field and add global invitation bell component

wizardchenb0b05b49c51c
diff --git a/frontend/src/api/tenant/index.ts b/frontend/src/api/tenant/index.ts
index f3f1a9c23..645e95516 100644
--- a/frontend/src/api/tenant/index.ts
+++ b/frontend/src/api/tenant/index.ts
@@ -71,14 +71,14 @@ export async function resetTenantApiKey(
}
/**
- * 更新租户信息(目前仅暴露租户名称编辑入口)。
- * 后端 `PUT /tenants/:id` 走 GORM 的 `Updates(tenant)`,只会写入请求体里
- * 出现的非零字段;这里只发送 `name` 就只会改名字,不会把其它字段清空。
+ * 更新租户信息(目前暴露名称、描述两个字段的编辑入口)。
+ * 后端 `PUT /tenants/:id` 用指针字段区分"未传"和"显式空串",未传的列不会
+ * 被改动;这里也按需选择性传 `name` / `description`,互不影响。
* 权限:owner(与 router.go 中的 g.Owner() 守卫保持一致)。
*/
export async function updateTenant(
tenantId: number,
- payload: { name: string },
+ payload: { name?: string; description?: string },
): Promise<{ success: boolean; data?: TenantInfo; message?: string }> {
try {
const response = await put(`/api/v1/tenants/${tenantId}`, payload)
diff --git a/frontend/src/components/GlobalInvitationBell.vue b/frontend/src/components/GlobalInvitationBell.vue
new file mode 100644
index 000000000..0847b644a
--- /dev/null
+++ b/frontend/src/components/GlobalInvitationBell.vue
@@ -0,0 +1,72 @@
+<template>
+ <!-- 全局右上角"待处理邀请"铃铛。
+ - 与原先 UserMenu 中铃铛的逻辑一致:只在 pendingInvitationCount > 0 时渲染,
+ 空收件箱场景不占用角落像素。
+ - 固定定位、z-index 远低于 t-drawer 默认 2500,业务页面右侧抽屉(FAQ、KB 调试、
+ Tenant 审计、SettingDrawer 等)弹出时会自然覆盖铃铛,不需要特意联动隐藏。
+ - 点击铃铛复用同一份 MyInvitationsDialog,行为与之前一致。 -->
+ <template v-if="pendingInvitationCount > 0">
+ <t-badge :count="pendingInvitationCount" :max-count="99" :offset="[6, 4]"
+ class="global-invitation-bell">
+ <button type="button" class="global-invitation-bell__btn"
+ :title="$t('tenantInvitation.inboxTooltip')" @click="openDialog">
+ <t-icon name="notification" size="18px" />
+ </button>
+ </t-badge>
+ </template>
+ <MyInvitationsDialog v-model:visible="dialogVisible" />
+</template>
+
+<script setup lang="ts">
+import { computed, ref } from 'vue'
+import { useAuthStore } from '@/stores/auth'
+import MyInvitationsDialog from '@/components/MyInvitationsDialog.vue'
+
+const authStore = useAuthStore()
+
+const pendingInvitationCount = computed(() => authStore.pendingInvitationCount)
+
+const dialogVisible = ref(false)
+const openDialog = () => {
+ dialogVisible.value = true
+}
+</script>
+
+<style lang="less" scoped>
+.global-invitation-bell {
+ position: fixed;
+ top: 12px;
+ right: 16px;
+ /* 远低于 TDesign 抽屉的默认 z-index (2500),确保业务页右侧抽屉弹出时能正常盖住铃铛。
+ 高于普通页面内容(一般 0~10),避免被列表卡片覆盖。 */
+ z-index: 100;
+}
+
+.global-invitation-bell__btn {
+ display: inline-flex;
+ align-items: center;
+ justify-content: center;
+ width: 32px;
+ height: 32px;
+ padding: 0;
+ border: 1px solid var(--td-component-stroke);
+ border-radius: 10px;
+ /* 用 container 背景而非透明,铃铛悬在内容区上方时和不同颜色的页面背景都能看清。 */
+ background: var(--td-bg-color-container);
+ color: var(--td-text-color-secondary);
+ cursor: pointer;
+ box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
+ transition: background-color 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
+
+ &:hover {
+ background-color: var(--td-bg-color-secondarycontainer);
+ color: var(--td-brand-color);
+ box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
+ }
+
+ &:focus-visible {
+ outline: 2px solid var(--td-brand-color-focus);
+ outline-offset: 1px;
+ }
+}
+</style>
diff --git a/frontend/src/components/UserMenu.vue b/frontend/src/components/UserMenu.vue
index c66715476..f2133c7e9 100644
--- a/frontend/src/components/UserMenu.vue
+++ b/frontend/src/components/UserMenu.vue
@@ -24,19 +24,6 @@
<div class="user-email">{{ userEmail }}</div>
</template>
</div>
- <!-- Pending-invitations bell. Sits in the trailing-icon slot
- of the avatar row (visually similar to a "升级/store" CTA
- icon in other products). Only renders when there is at
- least one pending invitation so the row stays minimal in
- the common empty-inbox case. Click-stop so the dropdown
- doesn't open along with the navigation. -->
- <t-badge v-if="pendingInvitationCount > 0" :count="pendingInvitationCount" :max-count="99" :offset="[6, 4]"
- class="user-inbox-badge-wrap">
- <button type="button" class="user-inbox-btn" :title="$t('tenantInvitation.inboxTooltip')"
- @click.stop="goToInvitations">
- <t-icon name="notification" size="18px" />
- </button>
- </t-badge>
<t-icon :name="menuVisible ? 'chevron-up' : 'chevron-down'" class="dropdown-icon" />
</template>
</div>
@@ -231,7 +218,6 @@
<!-- 创建工作区弹窗 -->
<CreateTenantDialog v-model:visible="createTenantDialogVisible" @created="onTenantCreated" />
- <MyInvitationsDialog v-model:visible="invitationsDialogVisible" />
</div>
</template>
@@ -245,7 +231,6 @@ import { getCurrentUser, logout as logoutApi } from '@/api/auth'
import { useI18n } from 'vue-i18n'
import IMChannelsOverviewPanel from '@/components/IMChannelsOverviewPanel.vue'
import CreateTenantDialog from '@/components/CreateTenantDialog.vue'
-import MyInvitationsDialog from '@/components/MyInvitationsDialog.vue'
import { listAllIMChannels, type IMChannelOverview } from '@/api/agent'
import { navigateAfterTenantSwitch } from '@/utils/tenantSwitch'
import type { TenantInfo } from '@/api/tenant'
@@ -327,25 +312,6 @@ const toggleMenu = () => {
menuVisible.value = !menuVisible.value
}
-// Pending invitation count surfaced as the trailing bell on the
-// avatar row. Reads directly from the auth store so the App.vue
-// poller and any local accept/decline updates flow through here
-// without a separate fetch. The visual badge cap (99+) is handled
-// by t-badge's max-count, so we just expose the raw count.
-const pendingInvitationCount = computed(() => authStore.pendingInvitationCount)
-
-// Clicking the bell opens the invitations dialog inline. Previously
-// this navigated to /platform/invitations, but the inbox is short-
-// lived ("see what's pending, accept or decline, dismiss") and a
-// dialog keeps the user in whatever context they came from. We
-// also close the avatar dropdown if it's open so the modal doesn't
-// fight with a stale hover panel.
-const invitationsDialogVisible = ref(false)
-const goToInvitations = () => {
- menuVisible.value = false
- invitationsDialogVisible.value = true
-}
-
// 快捷导航到设置的特定部分
const handleQuickNav = (section: string) => {
menuVisible.value = false
@@ -853,43 +819,6 @@ onUnmounted(() => {
transition: transform 0.2s;
}
-/* Pending-invitations bell, sits between user-info and the chevron.
- The button itself is a transparent 28x28 click target sized to
- match the avatar row's other trailing affordances; t-badge wraps
- it and positions its own counter pill in the top-right via the
- :offset prop, so we don't try to recreate badge positioning here. */
-.user-inbox-badge-wrap {
- display: inline-flex;
- align-items: center;
- margin: 0 2px;
- flex-shrink: 0;
-}
-
-.user-inbox-btn {
- display: inline-flex;
- align-items: center;
- justify-content: center;
- width: 28px;
- height: 28px;
- padding: 0;
- border: none;
- border-radius: 8px;
- background: transparent;
- color: var(--td-text-color-secondary);
- cursor: pointer;
- transition: background-color 0.18s ease, color 0.18s ease;
-
- &:hover {
- background-color: var(--td-bg-color-secondarycontainer);
- color: var(--td-brand-color);
- }
-
- &:focus-visible {
- outline: 2px solid var(--td-brand-color-focus);
- outline-offset: 1px;
- }
-}
-
.user-dropdown {
position: absolute;
bottom: 100%;
diff --git a/frontend/src/i18n/locales/en-US.ts b/frontend/src/i18n/locales/en-US.ts
index 3bcf8f9bf..ad16e8929 100755
--- a/frontend/src/i18n/locales/en-US.ts
+++ b/frontend/src/i18n/locales/en-US.ts
@@ -2411,7 +2411,12 @@ export default {
editNameCancel: 'Cancel',
editNameRequired: 'Tenant name cannot be empty',
editNameSuccess: 'Tenant name updated',
- editNameFailed: 'Failed to update tenant name'
+ editNameFailed: 'Failed to update tenant name',
+ editDescription: 'Edit description',
+ editDescriptionPlaceholder: 'Enter the new tenant description',
+ editDescriptionSuccess: 'Tenant description updated',
+ editDescriptionFailed: 'Failed to update tenant description',
+ descriptionEmptyPlaceholder: 'Not set'
},
storage: {
quotaLabel: 'Storage Quota',
diff --git a/frontend/src/i18n/locales/ko-KR.ts b/frontend/src/i18n/locales/ko-KR.ts
index 4c533a4f1..ad61a695a 100755
--- a/frontend/src/i18n/locales/ko-KR.ts
+++ b/frontend/src/i18n/locales/ko-KR.ts
@@ -1662,6 +1662,11 @@ export default {
editNameRequired: "테넌트 이름은 비어 있을 수 없습니다",
editNameSuccess: "테넌트 이름이 업데이트되었습니다",
editNameFailed: "테넌트 이름 업데이트 실패",
+ editDescription: "설명 수정",
+ editDescriptionPlaceholder: "새 테넌트 설명을 입력하세요",
+ editDescriptionSuccess: "테넌트 설명이 업데이트되었습니다",
+ editDescriptionFailed: "테넌트 설명 업데이트 실패",
+ descriptionEmptyPlaceholder: "미입력",
},
storage: {
quotaLabel: "저장소 할당량",
diff --git a/frontend/src/i18n/locales/ru-RU.ts b/frontend/src/i18n/locales/ru-RU.ts
index 7ae39fdab..b70e4fb39 100755
--- a/frontend/src/i18n/locales/ru-RU.ts
+++ b/frontend/src/i18n/locales/ru-RU.ts
@@ -1459,7 +1459,12 @@ export default {
editNameCancel: 'Отмена',
editNameRequired: 'Имя арендатора не может быть пустым',
editNameSuccess: 'Имя арендатора обновлено',
- editNameFailed: 'Не удалось обновить имя арендатора'
+ editNameFailed: 'Не удалось обновить имя арендатора',
+ editDescription: 'Изменить описание',
+ editDescriptionPlaceholder: 'Введите новое описание арендатора',
+ editDescriptionSuccess: 'Описание арендатора обновлено',
+ editDescriptionFailed: 'Не удалось обновить описание арендатора',
+ descriptionEmptyPlaceholder: 'Не указано'
},
storage: {
quotaLabel: 'Квота хранения',
diff --git a/frontend/src/i18n/locales/zh-CN.ts b/frontend/src/i18n/locales/zh-CN.ts
index c4878b0ab..b6e11173c 100755
--- a/frontend/src/i18n/locales/zh-CN.ts
+++ b/frontend/src/i18n/locales/zh-CN.ts
@@ -1642,6 +1642,11 @@ export default {
editNameRequired: "空间名称不能为空",
editNameSuccess: "空间名称已更新",
editNameFailed: "更新空间名称失败",
+ editDescription: "修改描述",
+ editDescriptionPlaceholder: "请输入新的空间描述",
+ editDescriptionSuccess: "空间描述已更新",
+ editDescriptionFailed: "更新空间描述失败",
+ descriptionEmptyPlaceholder: "未填写",
},
storage: {
quotaLabel: "存储配额",
diff --git a/frontend/src/views/organization/OrganizationSettingsModal.vue b/frontend/src/views/organization/OrganizationSettingsModal.vue
index 0163cd1b9..2605a3d35 100644
--- a/frontend/src/views/organization/OrganizationSettingsModal.vue
+++ b/frontend/src/views/organization/OrganizationSettingsModal.vue
@@ -359,9 +359,16 @@
</t-tag>
</div>
<div v-if="isAdmin && !isOwnerMember(member)" class="member-actions">
- <t-button variant="text" theme="danger" size="small" @click="handleRemoveMember(member)">
- <t-icon name="delete" />
- </t-button>
+ <t-popconfirm
+ :content="$t('organization.detail.removeMemberConfirm', { name: memberPrimaryLabel(member) })"
+ :confirm-btn="{ content: $t('common.confirm'), theme: 'danger' }"
+ :cancel-btn="{ content: $t('common.cancel') }"
+ placement="left"
+ @confirm="confirmRemoveMember(member)">
+ <t-button variant="text" theme="danger" size="small" @click.stop>
+ <t-icon name="delete" />
+ </t-button>
+ </t-popconfirm>
</div>
</div>
<div v-if="filteredMembers.length === 0" class="empty-members">
@@ -610,12 +617,6 @@
</div>
</Transition>
- <!-- 移除成员确认弹窗 -->
- <t-dialog v-model:visible="showRemoveDialog" :header="$t('organization.detail.removeMemberTitle')" theme="warning"
- :confirm-btn="$t('common.confirm')" :cancel-btn="$t('common.cancel')" @confirm="confirmRemoveMember">
- <p>{{ $t('organization.detail.removeMemberConfirm', { name: removingMember?.username }) }}</p>
- </t-dialog>
-
<!-- 申请权限升级弹窗 -->
<t-dialog v-model:visible="showUpgradeDialog" :header="$t('organization.upgrade.dialogTitle')"
:confirm-btn="{ content: $t('common.confirm'), loading: upgradeSubmitting }" :cancel-btn="$t('common.cancel')"
@@ -737,8 +738,6 @@ const submitting = ref(false)
const refreshingCode = ref(false)
const inviteCode = ref('')
const inviteCodeExpiresAt = ref<string | null>(null)
-const showRemoveDialog = ref(false)
-const removingMember = ref<OrganizationMember | null>(null)
const showUpgradeDialog = ref(false)
const upgradeSubmitting = ref(false)
const hasPendingUpgrade = ref(false)
@@ -1178,19 +1177,13 @@ const handleRoleChange = async (member: OrganizationMember, newRole: string) =>
}
}
-const handleRemoveMember = (member: OrganizationMember) => {
- removingMember.value = member
- showRemoveDialog.value = true
-}
-
-const confirmRemoveMember = async () => {
- if (!removingMember.value || !props.orgId) return
+const confirmRemoveMember = async (member: OrganizationMember) => {
+ if (!props.orgId) return
try {
- const res = await removeMember(props.orgId, removingMember.value.tenant_id)
+ const res = await removeMember(props.orgId, member.tenant_id)
if (res.success) {
MessagePlugin.success(t('organization.memberRemoved'))
- showRemoveDialog.value = false
fetchMembers()
} else {
MessagePlugin.error(res.message || t('organization.memberRemoveFailed'))
diff --git a/frontend/src/views/platform/index.vue b/frontend/src/views/platform/index.vue
index 0fd75e3a8..9913bf201 100644
--- a/frontend/src/views/platform/index.vue
+++ b/frontend/src/views/platform/index.vue
@@ -12,6 +12,9 @@
<Settings />
<!-- 全局命令面板 (⌘K),随 platform 路由存活 -->
<GlobalCommandPalette />
+ <!-- 全局右上角"待处理邀请"铃铛。固定定位,z-index 低于抽屉,业务页面
+ 右侧抽屉弹出时会自然覆盖;仅在有待处理邀请时渲染。 -->
+ <GlobalInvitationBell />
</div>
</template>
<script setup lang="ts">
@@ -22,6 +25,7 @@ import useKnowledgeBase from '@/hooks/useKnowledgeBase'
import UploadMask from '@/components/upload-mask.vue'
import Settings from '@/views/settings/Settings.vue'
import GlobalCommandPalette from '@/components/GlobalCommandPalette.vue'
+import GlobalInvitationBell from '@/components/GlobalInvitationBell.vue'
import { useCommandPaletteStore } from '@/stores/commandPalette'
import { getKnowledgeBaseById } from '@/api/knowledge-base/index'
import { MessagePlugin } from 'tdesign-vue-next'
diff --git a/frontend/src/views/settings/TenantInfo.vue b/frontend/src/views/settings/TenantInfo.vue
index 42a0400dd..b7c4eb287 100644
--- a/frontend/src/views/settings/TenantInfo.vue
+++ b/frontend/src/views/settings/TenantInfo.vue
@@ -69,13 +69,44 @@
</div>
<!-- Tenant description -->
- <div v-if="tenantInfo?.description" class="setting-row">
+ <div class="setting-row">
<div class="setting-info">
<label>{{ $t('tenant.details.descriptionLabel') }}</label>
<p class="desc">{{ $t('tenant.details.descriptionDescription') }}</p>
</div>
<div class="setting-control">
- <span class="info-value">{{ tenantInfo.description }}</span>
+ <!-- 只读态:显示描述(空时给占位)+ 编辑按钮(owner 才看得见编辑入口)。
+ 与名称同款"原地编辑"模式,少一层弹窗打断。 -->
+ <template v-if="!editingDescription">
+ <span class="info-value description-value" :class="{ 'is-empty': !tenantInfo?.description }">
+ {{ tenantInfo?.description || $t('tenant.details.descriptionEmptyPlaceholder') }}
+ </span>
+ <t-button v-if="canEditTenant" theme="default" variant="text" size="small" class="edit-btn"
+ @click="startEditDescription">
+ <template #icon>
+ <t-icon name="edit" />
+ </template>
+ {{ $t('tenant.details.editDescription') }}
+ </t-button>
+ </template>
+ <!-- 编辑态:textarea + 保存/取消。Esc 取消、Ctrl/⌘+Enter 保存;
+ textarea 上 Enter 默认换行更顺手,不接管 Enter 提交。 -->
+ <div v-else class="inline-edit inline-edit-description">
+ <t-textarea v-model="editDescription"
+ :placeholder="$t('tenant.details.editDescriptionPlaceholder')" :maxlength="512"
+ :autosize="{ minRows: 2, maxRows: 6 }" :disabled="savingDescription" autofocus
+ class="inline-edit-textarea" @keydown="onEditDescriptionKeydown" />
+ <div class="inline-edit-actions">
+ <t-button theme="primary" size="small" :loading="savingDescription"
+ :disabled="!canSubmitDescription" @click="saveTenantDescription">
+ {{ $t('tenant.details.editNameConfirm') }}
+ </t-button>
+ <t-button theme="default" variant="outline" size="small" :disabled="savingDescription"
+ @click="cancelEditDescription">
+ {{ $t('tenant.details.editNameCancel') }}
+ </t-button>
+ </div>
+ </div>
</div>
</div>
@@ -326,6 +357,70 @@ const onEditKeydown = (_value: any, ctx: { e: KeyboardEvent }) => {
}
}
+// 原地编辑空间描述:与名称对称的 editing / editValue / saving 三态。
+// 描述允许为空(业务上是可选字段),所以可提交条件不要求非空,只要内容变了即可。
+const editingDescription = ref(false)
+const editDescription = ref('')
+const savingDescription = ref(false)
+const editDescriptionTrimmed = computed(() => editDescription.value.trim())
+const canSubmitDescription = computed(
+ () => !savingDescription.value && editDescriptionTrimmed.value !== (tenantInfo.value?.description || ''),
+)
+
+const startEditDescription = () => {
+ editDescription.value = tenantInfo.value?.description || ''
+ editingDescription.value = true
+}
+
+const cancelEditDescription = () => {
+ if (savingDescription.value) return
+ editingDescription.value = false
+ editDescription.value = ''
+}
+
+// textarea 上 Enter 默认走换行,提交走 Ctrl/⌘+Enter;Esc 取消。
+const onEditDescriptionKeydown = (_value: any, ctx: { e: KeyboardEvent }) => {
+ const e = ctx?.e
+ if (!e) return
+ if (e.key === 'Escape') {
+ cancelEditDescription()
+ return
+ }
+ if (e.key === 'Enter' && (e.ctrlKey || e.metaKey)) {
+ e.preventDefault()
+ void saveTenantDescription()
+ }
+}
+
+const saveTenantDescription = async () => {
+ if (!tenantInfo.value?.id) return
+ const newDesc = editDescriptionTrimmed.value
+ if (newDesc === (tenantInfo.value.description || '')) {
+ editingDescription.value = false
+ return
+ }
+
+ try {
+ savingDescription.value = true
+ const resp = await updateTenantApi(Number(tenantInfo.value.id), { description: newDesc })
+ if (resp.success) {
+ // 本地立即回显,避免等 /auth/me 往返。描述不像名称那样会出现在租户切换器等
+ // 顶部组件里,所以无需同步 authStore.tenant / memberships。
+ if (tenantInfo.value) {
+ tenantInfo.value = { ...tenantInfo.value, description: newDesc }
+ }
+ MessagePlugin.success(t('tenant.details.editDescriptionSuccess'))
+ editingDescription.value = false
+ } else {
+ MessagePlugin.error(resp.message || t('tenant.details.editDescriptionFailed'))
+ }
+ } catch (err: any) {
+ MessagePlugin.error(err?.message || t('tenant.details.editDescriptionFailed'))
+ } finally {
+ savingDescription.value = false
+ }
+}
+
const saveTenantName = async () => {
const newName = editNameTrimmed.value
if (!newName) {
@@ -528,8 +623,13 @@ onMounted(() => {
}
.setting-info {
- flex: 1;
- max-width: 65%;
+ /* 不再 flex:1:标签列固定到 max-content 的合理范围内(CJK label 一般 4~6 字,
+ 再加 desc 文案撑宽),不参与剩余空间分配,避免被长内容挤到单字纵向换行。
+ min-width 兜底,desc 字数稍多时也不会被压缩到一字一行。 */
+ flex: 0 0 auto;
+ width: max-content;
+ min-width: 140px;
+ max-width: 40%;
padding-right: 24px;
label {
@@ -549,8 +649,10 @@ onMounted(() => {
}
.setting-control {
- flex-shrink: 0;
- min-width: 280px;
+ /* 反过来:内容列吃掉剩余空间,并允许收缩 + 内部换行,长字符串不会再撑爆行。
+ 去掉原先的 min-width:280px 硬约束(短内容也不需要那么宽的展示槽)。 */
+ flex: 1 1 auto;
+ min-width: 0;
display: flex;
justify-content: flex-end;
align-items: center;
@@ -560,7 +662,10 @@ onMounted(() => {
font-size: 14px;
color: var(--td-text-color-primary);
text-align: right;
- word-break: break-word;
+ /* anywhere 比 break-word 激进:连无空格的长串("WorkspaceDefault..." 这种)
+ 也能强制断行,避免单条内容把整行撑出。 */
+ overflow-wrap: anywhere;
+ min-width: 0;
}
.edit-btn {
@@ -583,6 +688,36 @@ onMounted(() => {
flex: 1;
}
+/* 描述行的原地编辑:textarea 自身可换行展开,按钮换到下方右对齐,
+ 避免名称行那样横向把按钮挤窄。 */
+.inline-edit-description {
+ flex-direction: column;
+ align-items: stretch;
+ gap: 8px;
+ width: 100%;
+ max-width: 360px;
+}
+
+.inline-edit-textarea {
+ width: 100%;
+}
+
+.inline-edit-actions {
+ display: flex;
+ justify-content: flex-end;
+ gap: 8px;
+}
+
+/* 只读态的描述:多行可换行;空描述用占位色提示用户可点编辑写入。 */
+.description-value {
+ white-space: pre-wrap;
+ word-break: break-word;
+
+ &.is-empty {
+ color: var(--td-text-color-placeholder);
+ }
+}
+
.leave-space-panel {
margin-top: 4px;
}
diff --git a/frontend/src/views/settings/TenantMembers.vue b/frontend/src/views/settings/TenantMembers.vue
index c264e174d..73fa813c0 100644
--- a/frontend/src/views/settings/TenantMembers.vue
+++ b/frontend/src/views/settings/TenantMembers.vue
@@ -248,10 +248,17 @@
</template>
<template #joined_at="{ row }">{{ formatDate(row.joined_at) }}</template>
<template #actions="{ row }">
- <t-button v-if="canManage && row.user_id !== currentUserId" theme="danger" variant="text" size="small"
- @click="confirmRemove(row)">
- {{ $t('tenantMember.remove.button') }}
- </t-button>
+ <t-popconfirm
+ v-if="canManage && row.user_id !== currentUserId"
+ :content="$t('tenantMember.remove.confirmBody', { name: row.username || row.email })"
+ :confirm-btn="{ content: $t('tenantMember.remove.confirm'), theme: 'danger' }"
+ :cancel-btn="{ content: $t('common.cancel') }"
+ placement="left"
+ @confirm="removeRow(row)">
+ <t-button theme="danger" variant="text" size="small" @click.stop>
+ {{ $t('tenantMember.remove.button') }}
+ </t-button>
+ </t-popconfirm>
</template>
</t-table>
</div>
@@ -354,7 +361,7 @@
<script setup lang="ts">
import { computed, nextTick, onUnmounted, reactive, ref, watch } from 'vue'
import { useI18n } from 'vue-i18n'
-import { DialogPlugin, MessagePlugin } from 'tdesign-vue-next'
+import { MessagePlugin } from 'tdesign-vue-next'
import { useAuthStore } from '@/stores/auth'
import {
listMembers,
@@ -1121,39 +1128,28 @@ async function onRoleChange(row: TenantMember, newRole: string) {
}
}
-function confirmRemove(row: TenantMember) {
- // Use DialogPlugin.confirm rather than t-popconfirm so we can describe
- // the consequences in a multi-line modal (matches the pattern used in
- // ApiInfo.vue's reset-API-key flow).
- const dlg = DialogPlugin.confirm({
- header: t('tenantMember.remove.confirmTitle'),
- body: t('tenantMember.remove.confirmBody', { name: row.username || row.email }),
- confirmBtn: { content: t('tenantMember.remove.confirm'), theme: 'danger' },
- cancelBtn: t('common.cancel'),
- onConfirm: async () => {
- try {
- const resp = await removeMember(activeTenantId.value, row.user_id)
- if (resp.success) {
- await loadMembers()
- MessagePlugin.success(t('tenantMember.remove.success'))
- } else {
- MessagePlugin.error(resp.message || t('tenantMember.errors.generic'))
- }
- } catch (err: any) {
- const status = err?.status
- if (status === 409) {
- MessagePlugin.error(t('tenantMember.errors.lastOwner'))
- } else if (status === 404) {
- MessagePlugin.error(t('tenantMember.errors.notFound'))
- } else {
- MessagePlugin.error(err?.message || t('tenantMember.errors.generic'))
- }
- } finally {
- dlg.destroy()
- }
- },
- onClose: () => dlg.destroy(),
- })
+// 原地 popconfirm 替代 DialogPlugin 模态确认:与"共享资源删除"等其它列表内
+// 的删除入口风格统一,避免一个简单的二次确认打断成员管理表格的浏览节奏。
+// 错误分支保持与旧实现一致(409 last-owner / 404 not-found / 兜底)。
+async function removeRow(row: TenantMember) {
+ try {
+ const resp = await removeMember(activeTenantId.value, row.user_id)
+ if (resp.success) {
+ await loadMembers()
+ MessagePlugin.success(t('tenantMember.remove.success'))
+ } else {
+ MessagePlugin.error(resp.message || t('tenantMember.errors.generic'))
+ }
+ } catch (err: any) {
+ const status = err?.status
+ if (status === 409) {
+ MessagePlugin.error(t('tenantMember.errors.lastOwner'))
+ } else if (status === 404) {
+ MessagePlugin.error(t('tenantMember.errors.notFound'))
+ } else {
+ MessagePlugin.error(err?.message || t('tenantMember.errors.generic'))
+ }
+ }
}
// Re-load whenever the active tenant resolves (or changes via the