fix(tenant): 封堵审计文件与历史用户跨站访问
This commit is contained in:
@@ -22,6 +22,7 @@ import {
|
||||
import { uploadAdminFile } from '@/shared/api/files'
|
||||
import { debugError } from '@/shared/utils/debug'
|
||||
import { readError } from '@/shared/utils/error'
|
||||
import { useDistributionSiteStore } from '@/stores/distributionSite'
|
||||
|
||||
interface Props {
|
||||
visible: boolean
|
||||
@@ -30,6 +31,7 @@ interface Props {
|
||||
}
|
||||
|
||||
const props = defineProps<Props>()
|
||||
const siteStore = useDistributionSiteStore()
|
||||
const emit = defineEmits<{
|
||||
'update:visible': [value: boolean]
|
||||
save: [data: CreateAnnouncementRequest | UpdateAnnouncementRequest]
|
||||
@@ -112,7 +114,7 @@ watch(
|
||||
if (val) {
|
||||
if (props.mode === 'edit' && props.announcement) {
|
||||
formData.value = {
|
||||
distribution_site_id: props.announcement.distribution_site_id,
|
||||
distribution_site_id: siteStore.isTenant ? 0 : props.announcement.distribution_site_id,
|
||||
title: props.announcement.title,
|
||||
content: props.announcement.content,
|
||||
category: props.announcement.category as any,
|
||||
@@ -133,7 +135,7 @@ watch(
|
||||
is_popup: false,
|
||||
}
|
||||
}
|
||||
void loadDistributionSites()
|
||||
if (!siteStore.isTenant) void loadDistributionSites()
|
||||
formRef.value?.clearValidate()
|
||||
}
|
||||
}
|
||||
@@ -309,7 +311,7 @@ function escapeMarkdownImageText(text: string) {
|
||||
<template>
|
||||
<el-dialog :model-value="visible" :title="dialogTitle" width="800px" @close="handleClose">
|
||||
<el-form ref="formRef" :model="formData" :rules="rules" label-width="100px">
|
||||
<el-form-item label="归属站点">
|
||||
<el-form-item v-if="!siteStore.isTenant" label="归属站点">
|
||||
<el-select
|
||||
v-if="mode === 'create'"
|
||||
v-model="formData.distribution_site_id"
|
||||
|
||||
@@ -29,10 +29,12 @@ import {
|
||||
} from '@/features/admin/api/adminDistribution'
|
||||
import type { Announcement } from '@/features/announcement'
|
||||
import { formatDateTime } from '@/shared/utils/time'
|
||||
import { useDistributionSiteStore } from '@/stores/distributionSite'
|
||||
import AnnouncementDialog from '../components/AnnouncementDialog.vue'
|
||||
import AdminTablePagination from '../components/AdminTablePagination.vue'
|
||||
|
||||
const loading = ref(false)
|
||||
const siteStore = useDistributionSiteStore()
|
||||
const announcements = ref<Announcement[]>([])
|
||||
const currentPage = ref(1)
|
||||
const currentPageSize = ref(20)
|
||||
@@ -62,7 +64,7 @@ const statusOptions = [
|
||||
]
|
||||
|
||||
onMounted(() => {
|
||||
void loadDistributionSites()
|
||||
if (!siteStore.isTenant) void loadDistributionSites()
|
||||
void loadAnnouncements()
|
||||
})
|
||||
|
||||
@@ -85,7 +87,7 @@ async function loadAnnouncements() {
|
||||
const result = await fetchAdminAnnouncements({
|
||||
status: statusFilter.value || undefined,
|
||||
category: categoryFilter.value || undefined,
|
||||
site_id: siteFilter.value === '' ? undefined : Number(siteFilter.value),
|
||||
site_id: siteStore.isTenant || siteFilter.value === '' ? undefined : Number(siteFilter.value),
|
||||
page: currentPage.value,
|
||||
page_size: currentPageSize.value,
|
||||
})
|
||||
@@ -247,6 +249,7 @@ function getStatusType(status: string): '' | 'success' | 'info' | 'warning' {
|
||||
|
||||
<div class="filter-bar">
|
||||
<el-select
|
||||
v-if="!siteStore.isTenant"
|
||||
v-model="siteFilter"
|
||||
placeholder="筛选站点"
|
||||
clearable
|
||||
@@ -315,7 +318,7 @@ function getStatusType(status: string): '' | 'success' | 'info' | 'warning' {
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="站点" width="150">
|
||||
<el-table-column v-if="!siteStore.isTenant" label="站点" width="150">
|
||||
<template #default="{ row }">
|
||||
<el-tag v-if="row.distribution_site_id" type="success" effect="plain" size="small">
|
||||
{{ siteLabel(row) }}
|
||||
|
||||
@@ -312,6 +312,22 @@
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.menu-item-scope {
|
||||
flex: none;
|
||||
margin-left: auto;
|
||||
padding: 0 5px;
|
||||
border: 1px solid #64748b;
|
||||
border-radius: 4px;
|
||||
color: #94a3b8;
|
||||
font-size: 10px;
|
||||
font-style: normal;
|
||||
line-height: 16px;
|
||||
}
|
||||
|
||||
:deep(.el-menu--collapse .menu-item-scope) {
|
||||
display: none;
|
||||
}
|
||||
|
||||
:deep(.el-menu--collapse .menu-item-badge) {
|
||||
position: absolute;
|
||||
top: 6px;
|
||||
|
||||
@@ -76,6 +76,7 @@ interface NavItem {
|
||||
to: string
|
||||
icon: Component
|
||||
permission?: string
|
||||
shared?: boolean
|
||||
}
|
||||
|
||||
interface NavGroup {
|
||||
@@ -107,6 +108,7 @@ const allNavGroups: NavGroup[] = [
|
||||
to: adminPath('points-mall'),
|
||||
icon: Present,
|
||||
permission: 'points_mall:view',
|
||||
shared: true,
|
||||
},
|
||||
{ label: '订单管理', to: adminPath('orders'), icon: Tickets, permission: 'order:view' },
|
||||
{
|
||||
@@ -120,6 +122,7 @@ const allNavGroups: NavGroup[] = [
|
||||
to: adminPath('pickup'),
|
||||
icon: Switch,
|
||||
permission: 'order:pickup',
|
||||
shared: true,
|
||||
},
|
||||
{ label: '商品管理', to: adminPath('listings'), icon: Shop, permission: 'listing:view' },
|
||||
{
|
||||
@@ -133,24 +136,28 @@ const allNavGroups: NavGroup[] = [
|
||||
to: adminPath('crash/categories'),
|
||||
icon: Present,
|
||||
permission: 'mohong:category',
|
||||
shared: true,
|
||||
},
|
||||
{
|
||||
label: '撞车商品',
|
||||
to: adminPath('crash/products'),
|
||||
icon: Present,
|
||||
permission: 'mohong:product_view',
|
||||
shared: true,
|
||||
},
|
||||
{
|
||||
label: '撞车订单',
|
||||
to: adminPath('crash/orders'),
|
||||
icon: Tickets,
|
||||
permission: 'mohong:order_view',
|
||||
shared: true,
|
||||
},
|
||||
{
|
||||
label: '撞车配置',
|
||||
to: adminPath('crash/config'),
|
||||
icon: Setting,
|
||||
permission: 'mohong:config',
|
||||
shared: true,
|
||||
},
|
||||
],
|
||||
},
|
||||
@@ -238,6 +245,7 @@ const allNavGroups: NavGroup[] = [
|
||||
to: adminPath('manual-entries'),
|
||||
icon: EditPen,
|
||||
permission: 'cs_manual_entry:view',
|
||||
shared: true,
|
||||
},
|
||||
],
|
||||
},
|
||||
@@ -567,6 +575,7 @@ async function handleForcedPasswordChange() {
|
||||
<el-icon><component :is="item.icon" /></el-icon>
|
||||
<template #title>
|
||||
<span class="menu-item-label">{{ item.label }}</span>
|
||||
<em v-if="siteStore.isTenant && item.shared" class="menu-item-scope">共享</em>
|
||||
<em
|
||||
v-if="item.to === refundReviewPath && pendingRefundCount > 0"
|
||||
class="menu-item-badge"
|
||||
|
||||
Reference in New Issue
Block a user