统一项目角色展示与预设文案
This commit is contained in:
@@ -12,12 +12,7 @@
|
||||
@change="onFilterChange"
|
||||
/>
|
||||
<el-select v-model="filters.role" placeholder="角色" clearable style="width: 130px" @change="onFilterChange">
|
||||
<el-option label="ADMIN" value="ADMIN" />
|
||||
<el-option label="PM" value="PM" />
|
||||
<el-option label="CRA" value="CRA" />
|
||||
<el-option label="PV" value="PV" />
|
||||
<el-option label="医学审核" value="MEDICAL_REVIEW" />
|
||||
<el-option label="IMP" value="IMP" />
|
||||
<el-option v-for="role in roleFilterOptions" :key="role.value" :label="role.label" :value="role.value" />
|
||||
</el-select>
|
||||
<el-select v-model="filters.allowed" placeholder="结果" clearable style="width: 100px" @change="onFilterChange">
|
||||
<el-option label="允许" :value="true" />
|
||||
@@ -157,11 +152,13 @@ import type {
|
||||
SecurityAccessLogsResponse,
|
||||
} from "@/types/api";
|
||||
import { Search as SearchIcon } from "@element-plus/icons-vue";
|
||||
import { useRoleTemplateMeta } from "@/composables/useRoleTemplateMeta";
|
||||
|
||||
const props = withDefaults(defineProps<{ showSecurityLog?: boolean }>(), {
|
||||
showSecurityLog: false,
|
||||
});
|
||||
const showSecurityLog = computed(() => props.showSecurityLog);
|
||||
const { roleLabel, roleOptionsFor, loadRoleTemplates } = useRoleTemplateMeta();
|
||||
|
||||
const MetricIconVisit = () => h("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2" }, [
|
||||
h("path", { d: "M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z" }),
|
||||
@@ -222,14 +219,8 @@ const filters = reactive({
|
||||
allowed: undefined as boolean | undefined,
|
||||
});
|
||||
|
||||
const ROLE_LABELS: Record<string, string> = {
|
||||
ADMIN: "管理员",
|
||||
PM: "项目负责人",
|
||||
CRA: "CRA",
|
||||
PV: "PV",
|
||||
MEDICAL_REVIEW: "医学审核",
|
||||
IMP: "药品管理",
|
||||
};
|
||||
const ROLE_FILTER_KEYS = ["ADMIN", "PM", "CRA", "PV", "MEDICAL_REVIEW", "IMP"];
|
||||
const roleFilterOptions = computed(() => roleOptionsFor(ROLE_FILTER_KEYS));
|
||||
|
||||
const SECURITY_AUTH_LABELS: Record<string, string> = {
|
||||
ANONYMOUS: "匿名",
|
||||
@@ -243,8 +234,6 @@ const formatTerminalTime = (iso: string) => {
|
||||
return `${date.getFullYear()}/${pad(date.getMonth() + 1)}/${pad(date.getDate())} ${pad(date.getHours())}:${pad(date.getMinutes())}:${pad(date.getSeconds())}`;
|
||||
};
|
||||
|
||||
const roleLabel = (role: string) => ROLE_LABELS[role] || role;
|
||||
|
||||
const formatIpLocation = (row: AccessLogItem) => {
|
||||
const parts = [row.ip_province, row.ip_city, row.ip_isp].filter(Boolean);
|
||||
return parts.length ? parts.join(" / ") : row.ip_location;
|
||||
@@ -437,7 +426,8 @@ const downloadSecurityLog = () => {
|
||||
downloadLogFile("security-event-audit.log", securityTerminalLines.value);
|
||||
};
|
||||
|
||||
onMounted(() => {
|
||||
onMounted(async () => {
|
||||
await loadRoleTemplates();
|
||||
refresh();
|
||||
startRealtimePolling();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user