列表内高频操作直达-初稿(ID问题未解决)
This commit is contained in:
@@ -23,7 +23,11 @@
|
||||
<el-card>
|
||||
<el-table :data="subjects" v-loading="loading" style="width: 100%" @row-click="goDetail">
|
||||
<el-table-column prop="subject_no" label="受试者编号" />
|
||||
<el-table-column prop="site_id" label="中心ID" />
|
||||
<el-table-column prop="site_id" label="中心">
|
||||
<template #default="scope">
|
||||
{{ siteName(scope.row.site_id) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="status" label="状态" width="120">
|
||||
<template #default="scope">
|
||||
<el-tag>{{ statusLabel(scope.row.status) }}</el-tag>
|
||||
@@ -66,6 +70,12 @@ const loading = ref(false);
|
||||
const total = ref(0);
|
||||
const page = ref(1);
|
||||
const pageSize = 10;
|
||||
const siteMap = computed(() =>
|
||||
sites.value.reduce<Record<string, string>>((acc, cur) => {
|
||||
acc[cur.id] = cur.name || cur.id;
|
||||
return acc;
|
||||
}, {})
|
||||
);
|
||||
|
||||
const statuses = ["SCREENING", "ENROLLED", "COMPLETED", "DROPPED"];
|
||||
|
||||
@@ -140,6 +150,8 @@ const statusLabel = (v: string) =>
|
||||
COMPLETED: "已完成",
|
||||
DROPPED: "已脱落",
|
||||
}[v] || v);
|
||||
|
||||
const siteName = (id: string) => siteMap.value[id] || id || "-";
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
Reference in New Issue
Block a user