限制系统邮件记录仅超管可见并校验唯一超级管理员
This commit is contained in:
1 parent
17d2a6d7e3
commit
7008885896
17 files changed
+398
-28
No files matched your search
@@ -102,6 +102,11 @@
|
||||
max-width: 190px;
|
||||
}
|
||||
|
||||
.log-filters .mail-scope {
|
||||
flex: 0 1 145px;
|
||||
min-width: 130px;
|
||||
}
|
||||
|
||||
.log-filter-actions {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
@@ -371,4 +376,4 @@
|
||||
.log-categories :deep(.el-radio-button__inner) {
|
||||
font-size: 12px;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -14,6 +14,9 @@ export function useLogs() {
|
||||
const offset = ref(0)
|
||||
const hasMore = ref(false)
|
||||
const actorId = ref('')
|
||||
const mailScope = ref('all')
|
||||
const canFilterSystemMail = computed(() => store.role === 'super_admin' && category.value === 'mail')
|
||||
const systemMailSelected = computed(() => canFilterSystemMail.value && mailScope.value === 'system')
|
||||
const recentRange = () => {
|
||||
const end = new Date()
|
||||
return [new Date(end.getTime() - 24 * 60 * 60 * 1000), end]
|
||||
@@ -38,7 +41,7 @@ export function useLogs() {
|
||||
const actionLabel = value => ({ update: '保存配置', rollback: '回滚配置', migration: '迁移配置' }[value] || value || '未记录操作')
|
||||
const displayObject = item => item.payload?.object || item.payload?.stage || '未记录对象'
|
||||
const displayOutcome = item => item.payload?.outcome || '历史记录未提供结果说明'
|
||||
const displayActor = item => item.payload?.actorName || (item.actorId && item.actorId !== '0' ? item.actorId : '系统')
|
||||
const displayActor = item => !item.actorId || item.actorId === '0' ? '系统' : (item.payload?.actorName || item.actorId)
|
||||
const details = computed(() => detail.value?.payload || {})
|
||||
const runtimeRows = computed(() => lines.value.map((line, index) => parseRuntimeLine(line, offset.value + index + 1)))
|
||||
const runtimeSummary = computed(() => summarizeRuntime(runtimeRows.value))
|
||||
@@ -93,7 +96,8 @@ export function useLogs() {
|
||||
return
|
||||
}
|
||||
appliedFilters = { kind: category.value, from: from.toISOString(), to: to.toISOString() }
|
||||
if (canFilterActor.value && !isRuntime.value && actorId.value.trim()) appliedFilters.actorId = actorId.value.trim()
|
||||
if (systemMailSelected.value) appliedFilters.systemOnly = true
|
||||
else if (canFilterActor.value && !isRuntime.value && actorId.value.trim()) appliedFilters.actorId = actorId.value.trim()
|
||||
offset.value = 0
|
||||
previousOffsets.length = 0
|
||||
detail.value = null
|
||||
@@ -120,6 +124,7 @@ export function useLogs() {
|
||||
runtimeDetail.value = null
|
||||
search()
|
||||
})
|
||||
watch(mailScope, search)
|
||||
onMounted(search)
|
||||
onBeforeUnmount(() => {
|
||||
++requestId
|
||||
@@ -129,6 +134,7 @@ export function useLogs() {
|
||||
return {
|
||||
category, categories, loading, error, items, lines, offset,
|
||||
canFilterActor,
|
||||
mailScope, canFilterSystemMail, systemMailSelected,
|
||||
hasMore, actorId, dateRange, detail, details, isRuntime,
|
||||
runtimeDetail, runtimeRows, runtimeSummary, visibleCount, pageRange,
|
||||
currentCategory, resultType, runtimeRowClass, timeParts,
|
||||
|
||||
@@ -19,7 +19,11 @@
|
||||
format="YYYY-MM-DD HH:mm"
|
||||
aria-label="日志时间范围"
|
||||
/>
|
||||
<el-input v-if="!isRuntime && canFilterActor" v-model="actorId" clearable placeholder="操作者编号" aria-label="操作者编号" @keyup.enter="search" />
|
||||
<el-select v-if="canFilterSystemMail" v-model="mailScope" class="mail-scope" aria-label="收发信记录范围">
|
||||
<el-option label="全部收发信" value="all" />
|
||||
<el-option label="系统收发信" value="system" />
|
||||
</el-select>
|
||||
<el-input v-if="!isRuntime && canFilterActor && !systemMailSelected" v-model="actorId" clearable placeholder="操作者编号" aria-label="操作者编号" @keyup.enter="search" />
|
||||
<div class="log-filter-actions">
|
||||
<el-button :disabled="loading" @click="recent">最近 24 小时</el-button>
|
||||
<el-button type="primary" :loading="loading" @click="search">查询</el-button>
|
||||
@@ -174,6 +178,7 @@ import { useLogs } from './LogSettings.js'
|
||||
const {
|
||||
category, categories, loading, error, items, offset,
|
||||
canFilterActor,
|
||||
mailScope, canFilterSystemMail, systemMailSelected,
|
||||
hasMore, actorId, dateRange, detail, details, isRuntime,
|
||||
runtimeDetail, runtimeRows, runtimeSummary, pageRange,
|
||||
currentCategory, resultType, runtimeRowClass, timeParts,
|
||||
@@ -181,4 +186,4 @@ const {
|
||||
} = useLogs()
|
||||
</script>
|
||||
|
||||
<style scoped src="./LogSettings.css"></style>
|
||||
<style scoped src="./LogSettings.css"></style>
|
||||
Reference in new issue
Block a user