feat(jd-database): 京东数据库写权限收窄到平台超管(编辑/删除/归类/分类管理)
2026-11-16 用户口径「京东数据库只有超管有编辑删除权限」:读(列表/类目/详情/分类列表)仍按 admin_jd_database 菜单权限放行;写(编辑、上传/替换图片、单行删除、批量删除、批量归类、分类新建/改名/删除)在菜单权限之上再要求平台超管(DeviceSessionPolicy#isSuper 只认站点 super_admin,company_super_admin 不在内),非超管 403。后端照 BrandGatingController#requirePlatformSuperAdmin / AdminDeviceLogController#requireSuperAdmin 同一判据;前端非超管隐藏勾选列/操作列/删除勾选/店铺分类入口并显示只读提示,列表/筛选/详情照常可用。判据:AdminJdProductControllerTest 新增读写分档结构钉+非超管 403 行为钉(商品五条写路由+分类三条写路由),挂载契约新增非超管只读/超管写入口两条。
This commit is contained in:
@@ -21,8 +21,15 @@ import { showAdminFeedback } from '@/components/admin-feedback-ui'
|
||||
import { openAdminConfirm } from '@/components/admin-confirm'
|
||||
import { loadFailureMessage } from '@/components/load-failure-model'
|
||||
import LoadFailureBar from '@/components/LoadFailureBar.vue'
|
||||
import { useAdminSessionStore } from '@/stores/admin-session'
|
||||
import { formatDateTime, orderedPair } from '@/utils/datetime'
|
||||
|
||||
/** 写权限口径(2026-11-16 用户口径「京东数据库只有超管有编辑删除权限」):读按菜单权限可见,
|
||||
* 写(编辑/删除/勾选批量删/店铺分类与批量归类)只对平台超级管理员渲染;后端同口径兜底 403
|
||||
* (公司超管不在内,判据是站点 super_admin)。 */
|
||||
const session = useAdminSessionStore()
|
||||
const isSuperAdmin = computed(() => session.isSuperAdmin)
|
||||
|
||||
const loading = ref(false)
|
||||
const loadFailure = ref('')
|
||||
const rows = ref<JdProductItem[]>([])
|
||||
@@ -276,13 +283,17 @@ onMounted(() => {
|
||||
<LoadFailureBar v-if="loadFailure" :message="loadFailure" @retry="load" />
|
||||
<div class="jd-toolbar">
|
||||
<span class="jd-summary">共 {{ total }} 条京东商品</span>
|
||||
<button class="btn btn-secondary" type="button" @click="groupDialogVisible = true">店铺分类</button>
|
||||
<!-- 写入口只对平台超管渲染(2026-11-16「只有超管有编辑删除权限」):非超管看到只读提示。 -->
|
||||
<span v-if="!isSuperAdmin" class="jd-readonly-tip">只读:编辑/删除仅超级管理员可用</span>
|
||||
<button v-if="isSuperAdmin" class="btn btn-secondary" type="button" @click="groupDialogVisible = true">店铺分类</button>
|
||||
<select v-model="filter.groupId" aria-label="筛选店铺分类" @change="apply">
|
||||
<option value="">全部分类</option>
|
||||
<option v-for="group in groupOptions" :key="group.id" :value="String(group.id)">{{ group.name }}</option>
|
||||
</select>
|
||||
<!-- 批量删除 2026-11-16 客户口径「不要勾选后才显示」:常显,勾选 0 时置灰。 -->
|
||||
<!-- 批量删除 2026-11-16 客户口径「不要勾选后才显示」:常显,勾选 0 时置灰。
|
||||
同日写权限收窄到超管:非超管整颗按钮不渲染(勾选列同窗隐藏)。 -->
|
||||
<button
|
||||
v-if="isSuperAdmin"
|
||||
class="btn btn-danger jd-delete-btn"
|
||||
type="button"
|
||||
:disabled="deleting || !selectedCount"
|
||||
@@ -295,21 +306,21 @@ onMounted(() => {
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th style="width: 42px"><input type="checkbox" :checked="allSelected" @change="toggleSelectAll(($event.target as HTMLInputElement).checked)" /></th>
|
||||
<th v-if="isSuperAdmin" style="width: 42px"><input type="checkbox" :checked="allSelected" @change="toggleSelectAll(($event.target as HTMLInputElement).checked)" /></th>
|
||||
<th style="width: 92px">分类</th>
|
||||
<th style="width: 520px">商品信息</th>
|
||||
<th style="width: 76px">总库存</th>
|
||||
<th style="width: 120px">价格</th>
|
||||
<!-- 同步时间收尾(创建/修改两列 2026-11-16 客户口径「不要」下线,仍收详情抽屉);
|
||||
操作列 2026-11-16「操作放最后一列」口径置末。 -->
|
||||
操作列 2026-11-16「操作放最后一列」口径置末;同日写权限收窄到超管 ⇒ 非超管不渲染。 -->
|
||||
<th style="width: 170px">同步时间</th>
|
||||
<th style="width: 138px">操作</th>
|
||||
<th v-if="isSuperAdmin" style="width: 138px">操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<template v-if="rows.length">
|
||||
<tr v-for="row in rows" :key="row.id" class="jd-row" @click="openDetail(row)">
|
||||
<td @click.stop><input type="checkbox" :checked="selectedIds.has(row.id)" @change="toggleSelect(row, ($event.target as HTMLInputElement).checked)" /></td>
|
||||
<td v-if="isSuperAdmin" @click.stop><input type="checkbox" :checked="selectedIds.has(row.id)" @change="toggleSelect(row, ($event.target as HTMLInputElement).checked)" /></td>
|
||||
<td :title="row.groupName || ''">{{ row.groupName || '未分类' }}</td>
|
||||
<td class="jd-info-cell">
|
||||
<div class="jd-info-wrap">
|
||||
@@ -337,18 +348,19 @@ onMounted(() => {
|
||||
<td>{{ jdPriceRange(row) || '-' }}</td>
|
||||
<td>{{ formatDateTime(row.syncedAt || '') }}</td>
|
||||
<!-- 操作列(2026-11-15 用户口径):编辑/删除;@click.stop 防冒泡开详情抽屉。
|
||||
2026-11-16「操作放最后一列」口径置末;「上架时间 / 商品状态」列同日整列下线。 -->
|
||||
<td class="jd-ops-cell" @click.stop>
|
||||
2026-11-16「操作放最后一列」口径置末;「上架时间 / 商品状态」列同日整列下线;
|
||||
同日写权限收窄到超管 ⇒ 非超管不渲染该列。 -->
|
||||
<td v-if="isSuperAdmin" class="jd-ops-cell" @click.stop>
|
||||
<button class="btn btn-sm" type="button" @click="openEdit(row)">编辑</button>
|
||||
<button class="btn btn-sm btn-danger" type="button" :disabled="deleting" @click="removeOne(row)">删除</button>
|
||||
</td>
|
||||
</tr>
|
||||
</template>
|
||||
<tr v-else-if="loading">
|
||||
<td colspan="7" class="empty-tip">加载中...</td>
|
||||
<td :colspan="isSuperAdmin ? 7 : 5" class="empty-tip">加载中...</td>
|
||||
</tr>
|
||||
<tr v-else>
|
||||
<td colspan="7" class="empty-tip">暂无京东商品数据</td>
|
||||
<td :colspan="isSuperAdmin ? 7 : 5" class="empty-tip">暂无京东商品数据</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
@@ -150,6 +150,12 @@ h3 {
|
||||
font-size: 13px;
|
||||
white-space: nowrap;
|
||||
}
|
||||
/* 非超管只读提示(2026-11-16 写权限收窄):紧跟汇总的一句话,不冒充可点按钮。 */
|
||||
.jd-readonly-tip {
|
||||
color: #8293a5;
|
||||
font-size: 12.5px;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.table-scroll {
|
||||
width: 100%;
|
||||
min-width: 0;
|
||||
|
||||
Reference in New Issue
Block a user