管理后台前后端逻辑、UI美化
This commit is contained in:
@@ -3,12 +3,18 @@
|
||||
<div class="page-header">
|
||||
<div>
|
||||
<h1 class="page-title">{{ TEXT.modules.startupMeetingAuth.title }}</h1>
|
||||
<p class="page-subtitle">{{ TEXT.modules.startupMeetingAuth.subtitle }}</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<el-card>
|
||||
<el-table :data="kickoffRows" v-loading="loading" style="width: 100%" class="ctms-table" @row-click="onKickoffRowClick">
|
||||
<el-table
|
||||
:data="kickoffRows"
|
||||
v-loading="loading"
|
||||
style="width: 100%"
|
||||
class="ctms-table"
|
||||
:row-class-name="kickoffRowClass"
|
||||
@row-click="onKickoffRowClick"
|
||||
>
|
||||
<el-table-column prop="site_name" :label="TEXT.common.fields.site" min-width="180" />
|
||||
<el-table-column prop="kickoff_date" :label="TEXT.common.fields.kickoffDate" width="160">
|
||||
<template #default="scope">{{ displayDate(scope.row.kickoff_date) }}</template>
|
||||
@@ -61,6 +67,14 @@ const memberNameMap = computed(() => {
|
||||
return map;
|
||||
});
|
||||
|
||||
const siteActiveMap = computed(() => {
|
||||
const map: Record<string, boolean> = {};
|
||||
sites.value.forEach((site) => {
|
||||
if (site?.id) map[site.id] = !!site.is_active;
|
||||
});
|
||||
return map;
|
||||
});
|
||||
|
||||
const contactLabel = (row: any) => {
|
||||
if (!row?.contact) return TEXT.common.fallback;
|
||||
return String(row.contact)
|
||||
@@ -76,17 +90,20 @@ const kickoffRows = computed(() => {
|
||||
if (item.site_id) acc[item.site_id] = item;
|
||||
return acc;
|
||||
}, {});
|
||||
return sites.value.map((site) => {
|
||||
const meeting = kickoffMap[site.id];
|
||||
return {
|
||||
site_id: site.id,
|
||||
site_name: site.name || TEXT.common.fallback,
|
||||
contact: site.contact,
|
||||
kickoff_date: meeting?.kickoff_date || null,
|
||||
meeting_id: meeting?.id,
|
||||
status: meeting?.kickoff_date ? "COMPLETED" : "PENDING",
|
||||
};
|
||||
});
|
||||
return sites.value
|
||||
.map((site) => {
|
||||
const meeting = kickoffMap[site.id];
|
||||
return {
|
||||
site_id: site.id,
|
||||
site_name: site.name || TEXT.common.fallback,
|
||||
contact: site.contact,
|
||||
kickoff_date: meeting?.kickoff_date || null,
|
||||
meeting_id: meeting?.id,
|
||||
status: meeting?.kickoff_date ? "COMPLETED" : "PENDING",
|
||||
is_active: !!site.is_active,
|
||||
};
|
||||
})
|
||||
.sort((a, b) => Number(a.is_active === false) - Number(b.is_active === false));
|
||||
});
|
||||
|
||||
const loadKickoffs = async () => {
|
||||
@@ -115,6 +132,10 @@ const goKickoffDetail = (id: string) => router.push(`/startup/kickoff/${id}`);
|
||||
const onKickoffRowClick = async (row: any) => {
|
||||
const studyId = study.currentStudy?.id;
|
||||
if (!studyId || !row?.site_id) return;
|
||||
if (row.is_active === false && !row.meeting_id) {
|
||||
ElMessage.warning("中心已停用");
|
||||
return;
|
||||
}
|
||||
if (row.meeting_id) {
|
||||
goKickoffDetail(row.meeting_id);
|
||||
return;
|
||||
@@ -126,6 +147,8 @@ const onKickoffRowClick = async (row: any) => {
|
||||
ElMessage.error(e?.response?.data?.message || TEXT.common.messages.createFailed);
|
||||
}
|
||||
};
|
||||
|
||||
const kickoffRowClass = ({ row }: { row: any }) => (row?.is_active === false ? "row-inactive" : "");
|
||||
onMounted(() => {
|
||||
loadKickoffs();
|
||||
});
|
||||
@@ -157,3 +180,14 @@ onMounted(() => {
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
<style>
|
||||
.row-inactive td {
|
||||
color: var(--ctms-text-secondary);
|
||||
background-color: #fff7d6 !important;
|
||||
}
|
||||
|
||||
.row-inactive .el-tag {
|
||||
opacity: 0.6;
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user