feat(platform): 后管菜单平台隔离收窄+列表密度收口(2026-11-18 用户截图口径「密钥管理与密钥用量统计仅亚马逊侧;菜单配置展示树按当前平台先裁剪再展平分页」)——①双侧共用清单四件收窄:AdminMenuPlatformScope.BOTH_MENU_KEYS(后端唯一出处)与 admin platform-scope.ts BOTH_PLATFORM_MENU_KEYS 同源去掉 admin_user_secrets/admin_user_secret_usage,密钥两页京东侧不再下发也不可配;②菜单管理页:全树字典保留(授权数据不动),展示树与父级候选走 filterMenuTreeNodesByPlatform 先裁剪再展平分页,切平台清筛选回页1并关弹窗;③列表密度收口:顶栏 76→56、内容区留白 30/32→12/16、筛选行 flex 换行紧凑、表格行距 6px、按钮/输入 34px 同高,三档响应式断点(1440/820/560,窄屏菜单项不再整体隐藏);task-243 顶栏 56px 断言随行、task-244 新钉六条紧凑断言与「窄屏不许 display:none 菜单项」反向钉。判据:AdminMenuPlatformScopeTest 11+AdminConsoleCurrentUserMenusPlatformTest 3(后端点名绿)+vue-tsc rc0+node --test 35+npx vitest run 全量 188/188 rc0(新增 menu-manage-platform.mount 3 支:京东侧菜单配置页无亚马逊项、保留账号域四件与京东工具、密钥页归亚马逊)+快检 overall=pass 四面绿(2026-11-18 12:5x,Git PATH 前置壳)
This commit is contained in:
@@ -37,18 +37,13 @@ export const JD_APP_MENU_KEYS: readonly string[] = [
|
||||
'jd-publish',
|
||||
]
|
||||
|
||||
/** 双侧共用菜单(2026-11-17 用户口径「这些亚马逊这边也要有」;2026-11-18 扩双侧):账号域
|
||||
* 页面在两个平台 tab 下都显示——同一套组件、按当前 tab 给接口传 platform,各自只看/管各自
|
||||
* 平台的账号、分组、公司(后端 V206 三表加列,存量默认亚马逊,京东侧数据在编辑弹窗里翻档)。
|
||||
* 2026-11-18 平台隔离落地(「非站点超管只看自己平台侧」)把三个账号域管理页也标双侧:
|
||||
* 它们是账号域功能而非亚马逊业务,京东侧公司超管被锁单侧后仍要能配菜单权限、管密钥。 */
|
||||
/** 双侧共用账号管理页面:用户、分组、公司与菜单权限配置。
|
||||
* 密钥管理/密钥用量统计按 2026-11-18 截图口径收回亚马逊侧。 */
|
||||
export const BOTH_PLATFORM_MENU_KEYS: readonly string[] = [
|
||||
'admin_users',
|
||||
'admin_group_manage',
|
||||
'admin_companies',
|
||||
'admin_columns',
|
||||
'admin_user_secrets',
|
||||
'admin_user_secret_usage',
|
||||
]
|
||||
|
||||
/** menuKey → 平台归属清单(唯一判定出口):京东独占(后台或桌面端清单)→ ['jd'];
|
||||
|
||||
@@ -6,6 +6,8 @@ import { computed, onMounted, reactive, ref, watch } from 'vue'
|
||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
import OldPagination from '@/components/OldPagination.vue'
|
||||
import { useCompanyTabStore } from '@/stores/company-tab'
|
||||
import { usePlatformTabStore } from '@/stores/platform-tab'
|
||||
import { filterMenuTreeNodesByPlatform } from '@/config/platform-scope'
|
||||
import { createMenu, deleteMenu, loadMenuManageTree, reorderMenus, updateMenu } from './menu-manage-api'
|
||||
import { showAdminFeedback } from '@/components/admin-feedback-ui'
|
||||
import { openAdminConfirm } from '@/components/admin-confirm'
|
||||
@@ -31,11 +33,22 @@ import {
|
||||
interface MenuRow extends MenuManageNode {
|
||||
depth: number
|
||||
}
|
||||
interface PlatformMenuNode extends MenuManageNode {
|
||||
key: string
|
||||
children?: PlatformMenuNode[]
|
||||
}
|
||||
|
||||
const companyTab = useCompanyTabStore()
|
||||
const loading = ref(false)
|
||||
const loadFailure = ref('')
|
||||
const rows = ref<MenuManageNode[]>([])
|
||||
const platformTab = usePlatformTabStore()
|
||||
// 菜单字典保留全树;显示与父级候选先分平台,再展平分页,避免京东项被亚马逊菜单挤到后页。
|
||||
const visibleMenuTree = computed(() => {
|
||||
const withKeys = (nodes: MenuManageNode[]): PlatformMenuNode[] =>
|
||||
nodes.map((node) => ({ ...node, key: node.columnKey, children: withKeys(node.children || []) }))
|
||||
return filterMenuTreeNodesByPlatform(withKeys(rows.value), platformTab.active)
|
||||
})
|
||||
/** 筛选:菜单名称/类型(用户要求账户域子菜单补筛选条件)。 */
|
||||
const filterName = ref('')
|
||||
const filterType = ref('')
|
||||
@@ -63,14 +76,14 @@ const menuRows = computed<MenuRow[]>(() => {
|
||||
if (node.children?.length) walk(node.children, depth + 1)
|
||||
}
|
||||
}
|
||||
walk(rows.value, 0)
|
||||
walk(visibleMenuTree.value, 0)
|
||||
return out
|
||||
})
|
||||
const createVisible = ref(false)
|
||||
const saving = ref(false)
|
||||
const editingNode = ref<MenuManageNode | null>(null)
|
||||
const menuForm = reactive<MenuManageForm>(createMenuForm(null, 0))
|
||||
const parentOptions = computed(() => menuParentCandidates(rows.value, menuForm.menuType))
|
||||
const parentOptions = computed(() => menuParentCandidates(visibleMenuTree.value, menuForm.menuType))
|
||||
const dialogTitle = computed(() => (editingNode.value ? '编辑菜单' : '新增菜单'))
|
||||
/** 节点 id -> 名称,供「上级菜单」列展示。 */
|
||||
const nameById = computed(() => {
|
||||
@@ -114,7 +127,7 @@ function openEdit(node: MenuManageNode) {
|
||||
|
||||
/** 菜单类型切换时:当前父菜单不属于新类型则重置为根。 */
|
||||
function onMenuTypeChange(): void {
|
||||
const candidates = menuParentCandidates(rows.value, menuForm.menuType)
|
||||
const candidates = menuParentCandidates(visibleMenuTree.value, menuForm.menuType)
|
||||
if (menuForm.parentId != null && !candidates.some((node) => node.id === menuForm.parentId)) {
|
||||
menuForm.parentId = null
|
||||
}
|
||||
@@ -215,6 +228,7 @@ async function removeMenu(node: MenuManageNode) {
|
||||
/** 切公司:菜单名称/类型是客户端筛选(在 filteredMenuRows 上筛,不进请求),留着上一家填的值
|
||||
* 就是拿别家的字符串去筛新一家那一套树 ⇒ 首屏「暂无匹配菜单」而输入框里还显示着它;页码回 1
|
||||
* 是因为新一家的行数不同。末尾的 void loadMenus() 才是本页唯一的数据出口。 */
|
||||
watch(() => platformTab.active, () => { filterName.value = ''; filterType.value = ''; page.value = 1; createVisible.value = false })
|
||||
watch(() => companyTab.activeId, () => { filterName.value = ''; filterType.value = ''; page.value = 1; void loadMenus() })
|
||||
|
||||
onMounted(loadMenus)
|
||||
|
||||
@@ -114,7 +114,7 @@ button, input, textarea, select { font: inherit; }
|
||||
.admin-main { display: flex; min-width: 0; flex: 1; flex-direction: column; }
|
||||
.admin-topbar {
|
||||
display: flex; align-items: center; justify-content: space-between; gap: 24px;
|
||||
min-height: 76px; padding: 0 32px;
|
||||
min-height: 56px; padding: 0 16px; flex-shrink: 0;
|
||||
background: rgba(255, 255, 255, 0.92);
|
||||
border-bottom: 1px solid var(--admin-border);
|
||||
box-shadow: 0 10px 28px -28px rgba(39, 67, 94, 0.42);
|
||||
@@ -135,8 +135,8 @@ button, input, textarea, select { font: inherit; }
|
||||
}
|
||||
.admin-user-logout.el-button:hover { color: var(--admin-primary-strong); border-color: #95b1cb; background: #edf5fb; }
|
||||
|
||||
.admin-content { flex: 1; min-width: 0; padding: 30px 32px 56px; overflow: auto; }
|
||||
.page-stack { display: flex; flex-direction: column; gap: 18px; }
|
||||
.admin-content { flex: 1; min-width: 0; min-height: 0; padding: 12px 16px 20px; overflow: auto; }
|
||||
.page-stack { display: flex; flex-direction: column; gap: 10px; }
|
||||
/* 表格操作按钮工具栏:置于表格卡片顶部、右对齐(新增/删除/导入/导出等贴近表格行操作)。 */
|
||||
.table-toolbar { display: flex; align-items: center; justify-content: flex-end; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
|
||||
.page-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
|
||||
@@ -227,11 +227,67 @@ button, input, textarea, select { font: inherit; }
|
||||
box-shadow: 0 0 0 3px rgba(95, 133, 173, 0.16);
|
||||
}
|
||||
|
||||
@media (max-width: 820px) {
|
||||
.admin-sidebar { flex-basis: 64px; }
|
||||
.admin-brand-copy, .admin-menu .el-sub-menu__title span, .admin-menu .el-menu-item { display: none; }
|
||||
.admin-topbar { align-items: flex-start; flex-direction: column; padding: 12px 18px; }
|
||||
.admin-user { width: 100%; justify-content: space-between; }
|
||||
.admin-user-meta { align-items: flex-start; }
|
||||
.admin-content { padding: 18px 16px 40px; }
|
||||
/* 列表密度统一收口;带壳层作用域的选择器覆盖各页 scoped 旧皮肤,不影响弹窗编辑表单。 */
|
||||
.admin-shell .admin-content :is(.panel-box, .form-box) { padding: 12px 14px; }
|
||||
.admin-shell .admin-content .el-card { --el-card-padding: 12px; }
|
||||
.admin-shell .admin-content > [class$="-view"] { gap: 10px; min-width: 0; }
|
||||
.admin-shell .admin-content :is(.panel-box, .form-box) h3 { margin-bottom: 8px; }
|
||||
.admin-shell .admin-content :is(.jd-panel-head, .dedupe-panel-head) { margin-bottom: 8px; }
|
||||
.admin-shell .admin-content :is(.jd-panel-head, .dedupe-panel-head) h3 { margin-bottom: 0; }
|
||||
.admin-shell .admin-content :is(.users-desc, .page-heading p) { margin-top: 4px; margin-bottom: 8px; }
|
||||
.admin-shell .admin-content :is(.form-row, .clean-filter-row, .dedupe-filter-row, .dedupe-filter-date-row, .jd-filter-row) {
|
||||
display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px; margin-bottom: 10px;
|
||||
}
|
||||
.admin-shell .admin-content :is(.clean-filter-row, .dedupe-filter-row, .jd-filter-row) > .form-group {
|
||||
flex: 1 1 140px; min-width: 0; max-width: 220px;
|
||||
}
|
||||
.admin-shell .admin-content :is(.form-row, .clean-filter-row, .dedupe-filter-row, .dedupe-filter-date-row, .jd-filter-row) .form-group { gap: 4px; }
|
||||
.admin-shell .admin-content :is(.panel-box, .form-box) .form-group input:not([type="checkbox"]):not([type="radio"]),
|
||||
.admin-shell .admin-content .jd-group-locked { min-height: 34px; padding: 5px 10px; }
|
||||
.admin-shell .admin-content .el-select.admin-filter .el-select__wrapper { min-height: 34px; padding: 4px 10px; }
|
||||
.admin-shell .admin-content :is(.panel-box, .form-box) .btn:not(.btn-sm) { min-height: 34px; padding: 5px 12px; }
|
||||
.admin-shell .admin-content :is(.clean-filter-actions, .dedupe-filter-actions, .jd-filter-actions) { flex-wrap: wrap; gap: 6px; }
|
||||
.admin-shell .admin-content .jd-filter-row > .el-select.admin-filter { width: 170px; }
|
||||
.admin-shell .admin-content :is(.table-toolbar, .clean-toolbar) { margin-bottom: 8px; }
|
||||
.admin-shell .admin-content :is(.table-scroll, .table-wrap) :is(th, td) { padding-top: 6px; padding-bottom: 6px; }
|
||||
.admin-shell .admin-content :is(.table-scroll, .table-wrap) .btn-sm { min-height: 28px; padding: 3px 6px; font-size: 12.5px; }
|
||||
.admin-shell .admin-content :is(.table-scroll, .table-wrap) .ops-cell { gap: 4px; }
|
||||
.admin-shell .admin-content .el-table .el-table__cell { padding: 5px 0; }
|
||||
.admin-shell .admin-content .old-pagination { gap: 8px; margin-top: 10px; }
|
||||
.admin-shell .admin-content .table-footer { padding-top: 10px; }
|
||||
.admin-shell .admin-content .admin-breadcrumb { margin-bottom: 8px; }
|
||||
.admin-shell .admin-content .company-tabs { margin-bottom: 8px; }
|
||||
.admin-shell .admin-content .company-tab { padding: 4px 12px; }
|
||||
.admin-shell .admin-content .operation-guide { margin-bottom: 10px; padding: 8px 12px; }
|
||||
.admin-shell .admin-content .og-body { margin-top: 4px; }
|
||||
.admin-shell .admin-content .og-text { line-height: 1.5; }
|
||||
.admin-shell .admin-content .og-steps { gap: 4px; margin-top: 4px; }
|
||||
|
||||
@media (max-width: 1440px) {
|
||||
.admin-sidebar { flex-basis: 208px; }
|
||||
.admin-content { padding: 10px 12px 16px; }
|
||||
}
|
||||
|
||||
@media (max-width: 820px) {
|
||||
.admin-sidebar { flex-basis: 160px; }
|
||||
.admin-brand { padding: 12px 10px; }
|
||||
.admin-brand-copy span, .admin-kicker { display: none; }
|
||||
.admin-topbar { min-height: 56px; gap: 8px; padding: 8px 12px; flex-wrap: wrap; }
|
||||
.admin-topbar h1 { margin-top: 0; font-size: 16px; }
|
||||
.admin-user { gap: 8px; flex-wrap: wrap; }
|
||||
.admin-content { padding: 8px 10px 12px; }
|
||||
.admin-shell .admin-content :is(.panel-box, .form-box) { padding: 10px; }
|
||||
.admin-shell .admin-content .form-row > .form-group { flex: 1 1 140px; min-width: 0; max-width: 100%; }
|
||||
}
|
||||
|
||||
@media (max-width: 560px) {
|
||||
.admin-sidebar { flex-basis: 128px; }
|
||||
.admin-brand { gap: 6px; }
|
||||
.admin-brand-logo { width: 28px; height: 28px; }
|
||||
.admin-brand-copy strong { font-size: 13px; }
|
||||
.admin-menu-scroll { padding: 8px 4px; }
|
||||
.admin-menu .el-sub-menu__title, .admin-menu .el-menu-item { padding: 0 8px; font-size: 12px; }
|
||||
.menu-group-title { font-size: 13px; }
|
||||
.admin-user-role { display: none; }
|
||||
.admin-shell .admin-content :is(.clean-filter-row, .dedupe-filter-row, .jd-filter-row) > .form-group { max-width: 100%; }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user