优化后台界面与无操作退出体验
This commit is contained in:
@@ -44,7 +44,6 @@ describe("FAQ project permissions", () => {
|
||||
expect(source).toContain("const onRowClick = (row: FaqItem) =>");
|
||||
expect(source).not.toContain('column?.property !== "question"');
|
||||
expect(source).toContain('@click.stop="remove(scope.row)"');
|
||||
expect(source).toContain('@click.stop="toggle(scope.row)"');
|
||||
});
|
||||
|
||||
it("splits FAQ category create update and delete controls by backend operation permissions", () => {
|
||||
@@ -53,8 +52,9 @@ describe("FAQ project permissions", () => {
|
||||
expect(source).toContain('const canCreateCategory = computed(() => can("faq.category.create"))');
|
||||
expect(source).toContain('const canUpdateCategory = computed(() => can("faq.category.update"))');
|
||||
expect(source).toContain('const canDeleteCategory = computed(() => can("faq.category.delete"))');
|
||||
expect(source).toContain('action="faq.category.update"');
|
||||
expect(source).toContain('action="faq.category.delete"');
|
||||
expect(source).toContain(':can-create="canCreateCategory"');
|
||||
expect(source).toContain(':can-update="canUpdateCategory"');
|
||||
expect(source).toContain(':can-delete="canDeleteCategory"');
|
||||
expect(source).not.toContain("const canDelete = computed(() => isAdmin.value)");
|
||||
});
|
||||
|
||||
|
||||
@@ -74,4 +74,17 @@ describe("Login protocol agreement", () => {
|
||||
expect(restoreIndex).toBeLessThan(projectOverviewRouteIndex);
|
||||
expect(source).toContain("preferActive: !!auth.user?.is_admin");
|
||||
});
|
||||
|
||||
it("shows persistent logout reason notices on the login card", () => {
|
||||
const source = readLoginView();
|
||||
|
||||
expect(source).toContain('v-if="logoutNotice"');
|
||||
expect(source).toContain("LOGOUT_REASON_TIMEOUT");
|
||||
expect(source).toContain("LOGOUT_REASON_AUTH_EXPIRED");
|
||||
expect(source).toContain("LOGOUT_REASON_MANUAL");
|
||||
expect(source).toContain("30 分钟未检测到任何操作。为保护项目数据,请重新登录后继续。");
|
||||
expect(source).toContain("登录状态已失效");
|
||||
expect(source).toContain("已安全退出");
|
||||
expect(source).toContain(".logout-notice");
|
||||
});
|
||||
});
|
||||
|
||||
@@ -27,6 +27,23 @@
|
||||
<p class="sys-subtitle">Log in to your account</p>
|
||||
</div>
|
||||
|
||||
<div v-if="logoutNotice" class="logout-notice" :class="'logout-notice--' + logoutNotice.type">
|
||||
<div class="logout-notice-icon" aria-hidden="true">
|
||||
<svg v-if="logoutNotice.type === 'warning'" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
||||
<circle cx="12" cy="12" r="10"></circle>
|
||||
<path d="M12 7v6"></path>
|
||||
<path d="M12 17h.01"></path>
|
||||
</svg>
|
||||
<svg v-else viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
||||
<path d="M20 6 9 17l-5-5"></path>
|
||||
</svg>
|
||||
</div>
|
||||
<div class="logout-notice-body">
|
||||
<strong>{{ logoutNotice.title }}</strong>
|
||||
<span>{{ logoutNotice.message }}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<el-form
|
||||
ref="formRef"
|
||||
:model="form"
|
||||
@@ -133,7 +150,12 @@ import { ElMessage, type FormInstance, type FormRules } from "element-plus";
|
||||
import { useAuthStore } from "../store/auth";
|
||||
import { useStudyStore } from "../store/study";
|
||||
import { TEXT, requiredMessage } from "../locales";
|
||||
import { consumeLogoutReason, LOGOUT_REASON_TIMEOUT } from "../session/sessionManager";
|
||||
import {
|
||||
consumeLogoutReason,
|
||||
LOGOUT_REASON_AUTH_EXPIRED,
|
||||
LOGOUT_REASON_MANUAL,
|
||||
LOGOUT_REASON_TIMEOUT,
|
||||
} from "../session/sessionManager";
|
||||
import { authProtocolSections } from "../content/authProtocol";
|
||||
|
||||
const auth = useAuthStore();
|
||||
@@ -162,13 +184,30 @@ const rules: FormRules<typeof form> = {
|
||||
|
||||
const loading = ref(false);
|
||||
const protocolDialogVisible = ref(false);
|
||||
const logoutNotice = ref<{ type: "info" | "warning"; title: string; message: string } | null>(null);
|
||||
|
||||
const protocolSections = authProtocolSections;
|
||||
|
||||
onMounted(async () => {
|
||||
const logoutReason = consumeLogoutReason();
|
||||
if (logoutReason === LOGOUT_REASON_TIMEOUT) {
|
||||
ElMessage.warning("长时间未操作,已自动退出登录,请重新登录");
|
||||
logoutNotice.value = {
|
||||
type: "warning",
|
||||
title: "已自动退出登录",
|
||||
message: "30 分钟未检测到任何操作。为保护项目数据,请重新登录后继续。",
|
||||
};
|
||||
} else if (logoutReason === LOGOUT_REASON_AUTH_EXPIRED) {
|
||||
logoutNotice.value = {
|
||||
type: "warning",
|
||||
title: "登录状态已失效",
|
||||
message: "当前会话无法继续使用,请重新登录。",
|
||||
};
|
||||
} else if (logoutReason === LOGOUT_REASON_MANUAL) {
|
||||
logoutNotice.value = {
|
||||
type: "info",
|
||||
title: "已安全退出",
|
||||
message: "本机登录状态已清除,需要时可再次登录。",
|
||||
};
|
||||
}
|
||||
form.email = localStorage.getItem("ctms_last_login_email") || "";
|
||||
form.rememberPassword = localStorage.getItem(REMEMBER_PASSWORD_KEY) === "true";
|
||||
@@ -357,6 +396,62 @@ const onSubmit = async () => {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.logout-notice {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
gap: 10px;
|
||||
margin: -14px 0 24px;
|
||||
padding: 12px 14px;
|
||||
border-radius: 12px;
|
||||
border: 1px solid;
|
||||
}
|
||||
|
||||
.logout-notice--warning {
|
||||
color: #8a5b12;
|
||||
background: #fff7e8;
|
||||
border-color: #f3d19e;
|
||||
}
|
||||
|
||||
.logout-notice--info {
|
||||
color: #315f49;
|
||||
background: #eef8f2;
|
||||
border-color: #b9dec8;
|
||||
}
|
||||
|
||||
.logout-notice-icon {
|
||||
width: 22px;
|
||||
height: 22px;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
flex-shrink: 0;
|
||||
margin-top: 1px;
|
||||
}
|
||||
|
||||
.logout-notice-icon svg {
|
||||
width: 18px;
|
||||
height: 18px;
|
||||
}
|
||||
|
||||
.logout-notice-body {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 2px;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.logout-notice-body strong {
|
||||
font-size: 13px;
|
||||
line-height: 18px;
|
||||
font-weight: 800;
|
||||
}
|
||||
|
||||
.logout-notice-body span {
|
||||
font-size: 12px;
|
||||
line-height: 18px;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.login-form :deep(.el-form-item) {
|
||||
margin-bottom: 22px;
|
||||
}
|
||||
|
||||
@@ -5,6 +5,18 @@ import { resolve } from "node:path";
|
||||
const readAuditLogsView = () => readFileSync(resolve(__dirname, "./AuditLogs.vue"), "utf8");
|
||||
|
||||
describe("audit logs access", () => {
|
||||
it("keeps the audit summary header compact", () => {
|
||||
const source = readAuditLogsView();
|
||||
|
||||
expect(source).toContain("padding: 10px 16px;");
|
||||
expect(source).toContain("padding: 9px 12px;");
|
||||
expect(source).toContain("width: 32px;");
|
||||
expect(source).toContain("height: 32px;");
|
||||
expect(source).toContain(".stat-icon svg { width: 18px; height: 18px; }");
|
||||
expect(source).toContain(".stat-value { font-size: 20px;");
|
||||
expect(source).toContain(".stat-label { font-size: 11px;");
|
||||
});
|
||||
|
||||
it("loads audit logs from the selected project context", () => {
|
||||
const source = readAuditLogsView();
|
||||
|
||||
|
||||
@@ -651,17 +651,17 @@ onMounted(async () => {
|
||||
.stats-row {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(4, 1fr);
|
||||
gap: 12px;
|
||||
padding: 16px;
|
||||
gap: 10px;
|
||||
padding: 10px 16px;
|
||||
border-bottom: 1px solid var(--unified-shell-divider);
|
||||
}
|
||||
|
||||
.stat-card {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
padding: 14px 16px;
|
||||
border-radius: 12px;
|
||||
gap: 10px;
|
||||
padding: 9px 12px;
|
||||
border-radius: 10px;
|
||||
background: var(--ctms-neutral-100);
|
||||
transition: var(--ctms-transition);
|
||||
}
|
||||
@@ -672,24 +672,24 @@ onMounted(async () => {
|
||||
}
|
||||
|
||||
.stat-icon {
|
||||
width: 38px;
|
||||
height: 38px;
|
||||
border-radius: 10px;
|
||||
width: 32px;
|
||||
height: 32px;
|
||||
border-radius: 8px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.stat-icon svg { width: 20px; height: 20px; }
|
||||
.stat-icon svg { width: 18px; height: 18px; }
|
||||
.stat-card--total .stat-icon { background: #e8edf3; color: var(--ctms-primary); }
|
||||
.stat-card--success .stat-icon { background: #e6f4ed; color: var(--ctms-success); }
|
||||
.stat-card--fail .stat-icon { background: #fde8e8; color: var(--ctms-danger); }
|
||||
.stat-card--operators .stat-icon { background: #eef2f6; color: var(--ctms-info); }
|
||||
|
||||
.stat-body { display: flex; flex-direction: column; }
|
||||
.stat-value { font-size: 22px; font-weight: 700; line-height: 1.2; color: var(--ctms-text-main); }
|
||||
.stat-label { font-size: 12px; color: var(--ctms-text-secondary); margin-top: 2px; }
|
||||
.stat-value { font-size: 20px; font-weight: 700; line-height: 1.2; color: var(--ctms-text-main); }
|
||||
.stat-label { font-size: 11px; color: var(--ctms-text-secondary); margin-top: 2px; }
|
||||
|
||||
/* 筛选栏 */
|
||||
.audit-toolbar {
|
||||
|
||||
@@ -74,6 +74,17 @@ describe("project management access", () => {
|
||||
expect(source).not.toContain('fixed="right"');
|
||||
});
|
||||
|
||||
it("keeps the project summary header compact", () => {
|
||||
const source = readProjects();
|
||||
|
||||
expect(source).toContain("padding: 10px 16px;");
|
||||
expect(source).toContain("padding: 9px 12px;");
|
||||
expect(source).toContain("width: 32px;");
|
||||
expect(source).toContain("height: 32px;");
|
||||
expect(source).toContain("font-size: 20px;");
|
||||
expect(source).toContain("font-size: 11px;");
|
||||
});
|
||||
|
||||
it("renders project names as plain text and moves setup configuration to a gear action", () => {
|
||||
const source = readProjects();
|
||||
|
||||
|
||||
@@ -375,16 +375,16 @@ onMounted(() => {
|
||||
.stats-row {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(4, 1fr);
|
||||
gap: 12px;
|
||||
padding: 16px;
|
||||
gap: 10px;
|
||||
padding: 10px 16px;
|
||||
}
|
||||
|
||||
.stat-card {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
padding: 14px 16px;
|
||||
border-radius: 12px;
|
||||
gap: 10px;
|
||||
padding: 9px 12px;
|
||||
border-radius: 10px;
|
||||
background: var(--ctms-neutral-100);
|
||||
transition: var(--ctms-transition);
|
||||
}
|
||||
@@ -395,9 +395,9 @@ onMounted(() => {
|
||||
}
|
||||
|
||||
.stat-icon {
|
||||
width: 38px;
|
||||
height: 38px;
|
||||
border-radius: 10px;
|
||||
width: 32px;
|
||||
height: 32px;
|
||||
border-radius: 8px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
@@ -405,8 +405,8 @@ onMounted(() => {
|
||||
}
|
||||
|
||||
.stat-icon svg {
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
width: 18px;
|
||||
height: 18px;
|
||||
}
|
||||
|
||||
.stat-card--total .stat-icon { background: #e8edf3; color: var(--ctms-primary); }
|
||||
@@ -420,14 +420,14 @@ onMounted(() => {
|
||||
}
|
||||
|
||||
.stat-value {
|
||||
font-size: 22px;
|
||||
font-size: 20px;
|
||||
font-weight: 700;
|
||||
line-height: 1.2;
|
||||
color: var(--ctms-text-main);
|
||||
}
|
||||
|
||||
.stat-label {
|
||||
font-size: 12px;
|
||||
font-size: 11px;
|
||||
color: var(--ctms-text-secondary);
|
||||
margin-top: 2px;
|
||||
}
|
||||
|
||||
@@ -17,14 +17,49 @@ describe("Admin users table labels", () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe("Admin users table layout", () => {
|
||||
it("uses a wider name column, even remaining columns, and compact icon actions", () => {
|
||||
const viewSource = readUsersView();
|
||||
|
||||
expect(viewSource).toContain('table-layout="fixed"');
|
||||
expect(viewSource).toContain(':label="TEXT.common.fields.name" width="360"');
|
||||
expect(viewSource).not.toContain('width="20%"');
|
||||
expect(viewSource).not.toContain('width="180"');
|
||||
expect(viewSource).not.toContain('width="160"');
|
||||
expect(viewSource).not.toContain('width="100"');
|
||||
expect(viewSource).not.toContain('fixed="right"');
|
||||
expect(viewSource).toContain('class="action-btn"');
|
||||
expect(viewSource).toContain("width: 28px;");
|
||||
expect(viewSource).toContain("gap: 4px;");
|
||||
});
|
||||
});
|
||||
|
||||
describe("Admin users summary header", () => {
|
||||
it("keeps the management summary header compact", () => {
|
||||
const viewSource = readUsersView();
|
||||
|
||||
expect(viewSource).toContain("padding: 10px 16px;");
|
||||
expect(viewSource).toContain("padding: 9px 12px;");
|
||||
expect(viewSource).toContain("width: 32px;");
|
||||
expect(viewSource).toContain("height: 32px;");
|
||||
expect(viewSource).toContain("font-size: 20px;");
|
||||
expect(viewSource).toContain("font-size: 11px;");
|
||||
});
|
||||
});
|
||||
|
||||
describe("Admin users filters", () => {
|
||||
it("applies keyword and status filters from the first page", () => {
|
||||
it("applies keyword automatically and status filters from the first page", () => {
|
||||
const viewSource = readUsersView();
|
||||
|
||||
expect(viewSource).toContain("@keyup.enter=\"applyFilters\"");
|
||||
expect(viewSource).toContain("@clear=\"applyFilters\"");
|
||||
expect(viewSource).toContain("@change=\"applyFilters\"");
|
||||
expect(viewSource).toContain("@click=\"applyFilters\"");
|
||||
expect(viewSource).not.toContain("@click=\"applyFilters\"");
|
||||
expect(viewSource).not.toContain(":icon=\"Refresh\"");
|
||||
expect(viewSource).not.toContain("Refresh } from");
|
||||
expect(viewSource).toContain("watch(searchKeyword, () => {");
|
||||
expect(viewSource).toContain("scheduleKeywordSearch();");
|
||||
expect(viewSource).toContain("keywordSearchTimer = setTimeout(() => {");
|
||||
expect(viewSource).toContain("}, 300);");
|
||||
expect(viewSource).toContain("page.value = 1");
|
||||
expect(viewSource).toContain("keyword: searchKeyword.value || undefined");
|
||||
expect(viewSource).toContain("status: statusFilter.value || undefined");
|
||||
|
||||
@@ -65,7 +65,6 @@
|
||||
clearable
|
||||
class="filter-input-comp"
|
||||
:prefix-icon="Search"
|
||||
@clear="applyFilters"
|
||||
@keyup.enter="applyFilters"
|
||||
/>
|
||||
</div>
|
||||
@@ -77,9 +76,6 @@
|
||||
<el-option :label="TEXT.enums.userStatus.DISABLED" value="DISABLED" />
|
||||
</el-select>
|
||||
</div>
|
||||
<div class="filter-item-form">
|
||||
<el-button @click="applyFilters" :icon="Refresh">{{ TEXT.common.actions.search }}</el-button>
|
||||
</div>
|
||||
<div class="filter-spacer"></div>
|
||||
<el-button type="primary" :icon="Plus" @click="openCreate">{{ TEXT.common.actions.add }}{{ TEXT.modules.adminUsers.userLabel }}</el-button>
|
||||
</div>
|
||||
@@ -88,7 +84,7 @@
|
||||
<!-- 用户表格 -->
|
||||
<div class="unified-section user-table-section">
|
||||
<el-table :data="users" v-loading="loading" class="user-table" style="width: 100%" table-layout="fixed">
|
||||
<el-table-column :label="TEXT.common.fields.name" min-width="200">
|
||||
<el-table-column :label="TEXT.common.fields.name" width="360">
|
||||
<template #default="scope">
|
||||
<div class="user-cell">
|
||||
<div class="user-avatar" :class="'avatar--' + (scope.row.status || '').toLowerCase()">
|
||||
@@ -102,40 +98,42 @@
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="clinical_department" :label="TEXT.modules.adminUsers.clinicalDepartmentLabel" show-overflow-tooltip />
|
||||
<el-table-column :label="TEXT.common.fields.status" width="100">
|
||||
<el-table-column :label="TEXT.common.fields.status">
|
||||
<template #default="scope">
|
||||
<span class="status-dot" :class="'dot--' + (scope.row.status || '').toLowerCase()"></span>
|
||||
{{ statusLabel(scope.row.status) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="created_at" :label="TEXT.modules.adminUsers.createdAt" width="160" show-overflow-tooltip>
|
||||
<el-table-column prop="created_at" :label="TEXT.modules.adminUsers.createdAt" show-overflow-tooltip>
|
||||
<template #default="scope">
|
||||
<span class="text-muted">{{ displayDateTime(scope.row.created_at) }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column :label="TEXT.common.labels.actions" width="180" align="center" fixed="right">
|
||||
<el-table-column :label="TEXT.common.labels.actions" align="center">
|
||||
<template #default="scope">
|
||||
<div class="action-row">
|
||||
<el-tooltip :content="TEXT.common.actions.edit" placement="top">
|
||||
<el-button link type="primary" :icon="Edit" @click="openEdit(scope.row)" />
|
||||
<el-button link type="primary" :icon="Edit" class="action-btn" @click="openEdit(scope.row)" />
|
||||
</el-tooltip>
|
||||
<el-tooltip :content="scope.row.status === 'ACTIVE' ? TEXT.common.actions.disable : TEXT.common.actions.enable" placement="top">
|
||||
<el-button
|
||||
link
|
||||
:type="scope.row.status === 'ACTIVE' ? 'warning' : 'success'"
|
||||
:icon="scope.row.status === 'ACTIVE' ? Lock : Unlock"
|
||||
class="action-btn"
|
||||
:disabled="isLastAdmin(scope.row)"
|
||||
@click="toggleStatus(scope.row)"
|
||||
/>
|
||||
</el-tooltip>
|
||||
<el-tooltip :content="TEXT.modules.adminUsers.resetPassword" placement="top">
|
||||
<el-button link type="warning" :icon="Key" @click="openReset(scope.row)" />
|
||||
<el-button link type="warning" :icon="Key" class="action-btn" @click="openReset(scope.row)" />
|
||||
</el-tooltip>
|
||||
<el-tooltip :content="TEXT.common.actions.delete" placement="top">
|
||||
<el-button
|
||||
link
|
||||
type="danger"
|
||||
:icon="Delete"
|
||||
class="action-btn"
|
||||
:disabled="scope.row.id === auth.user?.id"
|
||||
@click="onDelete(scope.row)"
|
||||
/>
|
||||
@@ -164,9 +162,9 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { computed, onMounted, ref } from "vue";
|
||||
import { computed, onBeforeUnmount, onMounted, ref, watch } from "vue";
|
||||
import { ElMessage, ElMessageBox } from "element-plus";
|
||||
import { Edit, Delete, Key, Lock, Unlock, Search, Plus, Refresh } from "@element-plus/icons-vue";
|
||||
import { Edit, Delete, Key, Lock, Unlock, Search, Plus } from "@element-plus/icons-vue";
|
||||
import { fetchUsers, updateUser, deleteUser } from "../../api/users";
|
||||
import { fetchStudies } from "../../api/studies";
|
||||
import { listMembers } from "../../api/members";
|
||||
@@ -191,6 +189,7 @@ const statusFilter = ref("");
|
||||
const editingUser = ref<UserInfo | null>(null);
|
||||
const resetUser = ref<UserInfo | null>(null);
|
||||
const auth = useAuthStore();
|
||||
let keywordSearchTimer: ReturnType<typeof setTimeout> | null = null;
|
||||
|
||||
const activeCount = computed(() => allUsers.value.filter(u => u.status === 'ACTIVE').length);
|
||||
const pendingCount = computed(() => allUsers.value.filter(u => u.status === 'PENDING').length);
|
||||
@@ -251,10 +250,30 @@ const loadUsers = async () => {
|
||||
};
|
||||
|
||||
const applyFilters = () => {
|
||||
clearKeywordSearchTimer();
|
||||
page.value = 1;
|
||||
loadUsers();
|
||||
};
|
||||
|
||||
const clearKeywordSearchTimer = () => {
|
||||
if (!keywordSearchTimer) return;
|
||||
clearTimeout(keywordSearchTimer);
|
||||
keywordSearchTimer = null;
|
||||
};
|
||||
|
||||
const scheduleKeywordSearch = () => {
|
||||
clearKeywordSearchTimer();
|
||||
keywordSearchTimer = setTimeout(() => {
|
||||
keywordSearchTimer = null;
|
||||
page.value = 1;
|
||||
loadUsers();
|
||||
}, 300);
|
||||
};
|
||||
|
||||
watch(searchKeyword, () => {
|
||||
scheduleKeywordSearch();
|
||||
});
|
||||
|
||||
const onPageSizeChange = (size: number) => {
|
||||
pageSize.value = size;
|
||||
page.value = 1;
|
||||
@@ -360,23 +379,27 @@ const findUserProjects = async (userId: string) => {
|
||||
onMounted(() => {
|
||||
loadUsers();
|
||||
});
|
||||
|
||||
onBeforeUnmount(() => {
|
||||
clearKeywordSearchTimer();
|
||||
});
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.stats-row {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(4, 1fr);
|
||||
gap: 12px;
|
||||
padding: 16px;
|
||||
gap: 10px;
|
||||
padding: 10px 16px;
|
||||
border-bottom: 1px solid var(--unified-shell-divider);
|
||||
}
|
||||
|
||||
.stat-card {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
padding: 14px 16px;
|
||||
border-radius: 12px;
|
||||
gap: 10px;
|
||||
padding: 9px 12px;
|
||||
border-radius: 10px;
|
||||
background: var(--ctms-neutral-100);
|
||||
transition: var(--ctms-transition);
|
||||
}
|
||||
@@ -387,9 +410,9 @@ onMounted(() => {
|
||||
}
|
||||
|
||||
.stat-icon {
|
||||
width: 38px;
|
||||
height: 38px;
|
||||
border-radius: 10px;
|
||||
width: 32px;
|
||||
height: 32px;
|
||||
border-radius: 8px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
@@ -397,8 +420,8 @@ onMounted(() => {
|
||||
}
|
||||
|
||||
.stat-icon svg {
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
width: 18px;
|
||||
height: 18px;
|
||||
}
|
||||
|
||||
.stat-card--total .stat-icon {
|
||||
@@ -427,14 +450,14 @@ onMounted(() => {
|
||||
}
|
||||
|
||||
.stat-value {
|
||||
font-size: 22px;
|
||||
font-size: 20px;
|
||||
font-weight: 700;
|
||||
line-height: 1.2;
|
||||
color: var(--ctms-text-main);
|
||||
}
|
||||
|
||||
.stat-label {
|
||||
font-size: 12px;
|
||||
font-size: 11px;
|
||||
color: var(--ctms-text-secondary);
|
||||
margin-top: 2px;
|
||||
}
|
||||
@@ -559,10 +582,49 @@ onMounted(() => {
|
||||
.action-row {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
justify-content: center;
|
||||
gap: 4px;
|
||||
padding: 2px;
|
||||
border-radius: 8px;
|
||||
background: rgba(248, 250, 252, 0.72);
|
||||
box-shadow: inset 0 0 0 1px rgba(148, 163, 184, 0.14);
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.action-btn {
|
||||
width: 28px;
|
||||
height: 28px;
|
||||
min-height: 28px;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
border-radius: 7px;
|
||||
font-size: 15px;
|
||||
background: linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(248, 250, 252, 0.82));
|
||||
box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06), inset 0 0 0 1px rgba(148, 163, 184, 0.16);
|
||||
transition: transform 120ms ease, box-shadow 120ms ease, background-color 120ms ease;
|
||||
}
|
||||
|
||||
.action-row :deep(.el-button + .el-button) {
|
||||
margin-left: 0;
|
||||
}
|
||||
|
||||
.action-row :deep(.el-button .el-icon) {
|
||||
width: 15px;
|
||||
height: 15px;
|
||||
}
|
||||
|
||||
.action-btn:hover {
|
||||
transform: translateY(-1px);
|
||||
background: #fff;
|
||||
box-shadow: 0 4px 10px rgba(15, 23, 42, 0.1), inset 0 0 0 1px rgba(148, 163, 184, 0.22);
|
||||
}
|
||||
|
||||
.action-btn.is-disabled {
|
||||
transform: none;
|
||||
opacity: 0.45;
|
||||
box-shadow: inset 0 0 0 1px rgba(148, 163, 184, 0.12);
|
||||
}
|
||||
|
||||
/* 表格区域 */
|
||||
.user-table-section {
|
||||
padding: 0;
|
||||
|
||||
@@ -14,6 +14,7 @@ describe("DocumentDetail role labels", () => {
|
||||
expect(source).toContain("label: `${name}(${roleLabel(m.role_in_study)})`");
|
||||
expect(source).toContain("return roleLabel(row.target_id);");
|
||||
expect(source).toContain("await loadRoleTemplates();");
|
||||
expect(source).toContain("await loadDetail();");
|
||||
expect(source).not.toContain("displayEnum(TEXT.enums.userRole, value)");
|
||||
expect(source).not.toContain("displayEnum(TEXT.enums.userRole, m.role_in_study)");
|
||||
});
|
||||
@@ -99,8 +100,8 @@ describe("DocumentDetail editor overlays", () => {
|
||||
it("uses right-side drawers for upload and distribution forms", () => {
|
||||
const source = readSource();
|
||||
|
||||
expect(source).toContain("upload-editor-drawer");
|
||||
expect(source).toContain("distribution-editor-drawer");
|
||||
expect(source).toContain("upload-drawer");
|
||||
expect(source).toContain("editor-drawer");
|
||||
expect(source).toContain('direction="rtl"');
|
||||
expect(source).toContain(':show-close="false"');
|
||||
expect(source).toContain("editor-header");
|
||||
|
||||
@@ -870,7 +870,10 @@ watch(previewVisible, (visible) => {
|
||||
}
|
||||
});
|
||||
|
||||
onMounted(() => { loadDetail(); });
|
||||
onMounted(async () => {
|
||||
await loadRoleTemplates();
|
||||
await loadDetail();
|
||||
});
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
@@ -45,19 +45,22 @@ describe("ContractFeeDetail permissions", () => {
|
||||
it("keeps payment table columns evenly distributed with clear labels", () => {
|
||||
const source = readDetail();
|
||||
|
||||
expect(source).toContain(':label="TEXT.modules.feeContracts.paymentSeqColumn"');
|
||||
expect(source).toContain('v-for="(payment, index) in detail.payments"');
|
||||
expect(source).toContain("TEXT.modules.feeContracts.paymentSeq");
|
||||
expect(source).toContain("TEXT.modules.feeContracts.paidFlag");
|
||||
expect(source).toContain("TEXT.modules.feeContracts.verifiedFlag");
|
||||
expect(source).toContain("tl-panel-amount");
|
||||
expect(source).not.toContain('width="20%"');
|
||||
expect(source.match(/min-width="180"/g)).toHaveLength(5);
|
||||
expect(source).not.toContain(".payment-table :deep(col:nth-child(-n + 5))");
|
||||
expect(source).toContain(':label="TEXT.common.fields.amount" align="left" header-align="left" min-width="180"');
|
||||
});
|
||||
|
||||
it("uses ten-thousand yuan as the only amount unit and hides currency", () => {
|
||||
const source = readDetail();
|
||||
|
||||
expect(source).toContain("formatAmountWan(detail.contract_amount)");
|
||||
expect(source).toContain("formatAmountWan(scope.row.amount)");
|
||||
expect(source).toContain('<span class="amount-unit">万</span>');
|
||||
expect(source).toContain("formatAmountWan(payment.amount)");
|
||||
expect(source).toContain('<span class="stat-tile-unit">万</span>');
|
||||
expect(source).toContain('<span class="amount-unit-sm">万</span>');
|
||||
expect(source).not.toContain("TEXT.common.fields.currency");
|
||||
expect(source).not.toContain("detail.currency");
|
||||
expect(source).not.toContain("currencyDefault");
|
||||
|
||||
@@ -20,18 +20,18 @@ describe("DrugShipments project permissions", () => {
|
||||
it("uses flexible data columns so the table fills the available page width", () => {
|
||||
const source = readSource();
|
||||
|
||||
expect(source).toContain('class="ctms-table shipment-table"');
|
||||
expect(source).toContain('class="shipment-table"');
|
||||
expect(source).toContain('style="width: 100%"');
|
||||
expect(source).toContain('table-layout="fixed"');
|
||||
expect(source).toContain(':label="TEXT.common.labels.actions" width="130"');
|
||||
expect(source).toContain(':label="TEXT.common.labels.actions" fixed="right"');
|
||||
expect(source).not.toMatch(/prop="(?:site_name|direction|ship_date|receive_date|quantity|batch_no|status|remark)"[^>]+(?:min-width|width)=/);
|
||||
});
|
||||
|
||||
it("keeps edit and delete actions on one line", () => {
|
||||
const source = readSource();
|
||||
|
||||
expect(source).toContain('class="shipment-actions"');
|
||||
expect(source).toContain(".shipment-actions");
|
||||
expect(source).toContain('class="cell-actions"');
|
||||
expect(source).toContain(".cell-actions");
|
||||
expect(source).toContain("white-space: nowrap;");
|
||||
});
|
||||
|
||||
@@ -43,11 +43,10 @@ describe("DrugShipments project permissions", () => {
|
||||
expect(source).toContain('entity-type="drug_shipment"');
|
||||
expect(source).toContain(':entity-id="editingId"');
|
||||
expect(source).toContain(':mode="\'upload\'"');
|
||||
expect(source).toContain(':center-upload-card-content="true"');
|
||||
expect(source).toContain("attachmentPanelRef.value?.pendingSnapshot() || []");
|
||||
expect(source).toContain("await attachmentPanelRef.value?.uploadPending(shipmentId)");
|
||||
expect(source).toContain("uploadPending");
|
||||
expect(source).toContain("group-dot-attachment");
|
||||
expect(source).toContain("dot--purple");
|
||||
expect(source).not.toContain("uploadAttachment");
|
||||
expect(source).not.toContain("pendingFiles");
|
||||
expect(source).not.toContain("upload-card-label");
|
||||
|
||||
@@ -23,11 +23,11 @@ describe("MaterialEquipment project permissions", () => {
|
||||
it("keeps the visible table columns evenly distributed", () => {
|
||||
const source = readSource();
|
||||
|
||||
expect(source).toContain('class="ctms-table equipment-table"');
|
||||
expect(source).toContain('class="equipment-table"');
|
||||
expect(source).toContain('style="width: 100%"');
|
||||
expect(source).toContain('table-layout="fixed"');
|
||||
expect(source).toContain('label="操作"');
|
||||
expect(source).not.toMatch(/<el-table-column[^>]+label="操作"[^>]+(?:width|min-width)=/);
|
||||
expect(source).not.toMatch(/<el-table-column[^>]+prop="(?:name|specModel|unit|brand)"[^>]+(?:width|min-width)=/);
|
||||
});
|
||||
|
||||
it("opens the detail page from row clicks instead of a detail action button", () => {
|
||||
@@ -54,7 +54,6 @@ describe("MaterialEquipment project permissions", () => {
|
||||
expect(source).toContain('entity-type="material_equipment"');
|
||||
expect(source).toContain(':entity-id="editingId"');
|
||||
expect(source).toContain(':mode="\'upload\'"');
|
||||
expect(source).toContain(':center-upload-card-content="true"');
|
||||
expect(source).toContain("attachmentPanelRef.value?.pendingSnapshot() || []");
|
||||
expect(source).toContain("await attachmentPanelRef.value?.uploadPending(equipmentId)");
|
||||
expect(source).toContain("uploadPending");
|
||||
|
||||
@@ -20,10 +20,10 @@ describe("StartupFeasibilityEthics project permissions", () => {
|
||||
expect(source).toContain('v-if="canReadEthics"');
|
||||
expect(source).toContain("if (!canReadFeasibility.value)");
|
||||
expect(source).toContain("if (!canReadEthics.value)");
|
||||
expect(source).toContain('v-if="canCreateFeasibility"');
|
||||
expect(source).toContain('v-if="activeTab === \'feasibility\' && canCreateFeasibility"');
|
||||
expect(source).toContain('v-if="canUpdateFeasibility"');
|
||||
expect(source).toContain('v-if="canDeleteFeasibility"');
|
||||
expect(source).toContain('v-if="canCreateEthics"');
|
||||
expect(source).toContain('v-if="activeTab === \'ethics\' && canCreateEthics"');
|
||||
expect(source).toContain('v-if="canUpdateEthics"');
|
||||
expect(source).toContain('v-if="canDeleteEthics"');
|
||||
});
|
||||
|
||||
@@ -30,9 +30,10 @@ describe("route view overlays are mounted only when visible", () => {
|
||||
file: "./subjects/SubjectDetail.vue",
|
||||
snippets: [
|
||||
'<el-dialog v-if="historyDialogVisible"',
|
||||
'<el-dialog v-if="visitDialogVisible"',
|
||||
'<el-dialog v-if="aeDialogVisible"',
|
||||
'<el-dialog v-if="pdDialogVisible"',
|
||||
'<VisitEditorDrawer',
|
||||
'<el-drawer v-if="adherenceDrawerVisible"',
|
||||
'<el-drawer v-if="aeDrawerVisible"',
|
||||
'<el-drawer v-if="pdDrawerVisible"',
|
||||
],
|
||||
},
|
||||
{
|
||||
|
||||
@@ -106,13 +106,13 @@ describe("startup auth form/detail permissions", () => {
|
||||
it("shows training and authorization dates under positive status in the training table", () => {
|
||||
const source = read("./KickoffDetail.vue");
|
||||
|
||||
expect(source).toContain("trainingStatusLabel(scope.row)");
|
||||
expect(source).toContain("authorizationStatusLabel(scope.row)");
|
||||
expect(source).toContain("status-dot--yes");
|
||||
expect(source).toContain("status-dot--no");
|
||||
expect(source).toContain("scope.row.trained && scope.row.trained_date");
|
||||
expect(source).toContain("scope.row.authorized && scope.row.authorized_date");
|
||||
expect(source).toContain('class="status-date-small"');
|
||||
expect(source).not.toContain("scope.row.trained ? TEXT.common.boolean.yes : TEXT.common.boolean.no");
|
||||
expect(source).not.toContain("scope.row.authorized ? TEXT.common.boolean.yes : TEXT.common.boolean.no");
|
||||
expect(source).toContain('class="status-date"');
|
||||
expect(source).toContain("scope.row.trained ? TEXT.common.boolean.yes : TEXT.common.boolean.no");
|
||||
expect(source).toContain("scope.row.authorized ? TEXT.common.boolean.yes : TEXT.common.boolean.no");
|
||||
});
|
||||
|
||||
it("loads training authorizations for the current kickoff site only", () => {
|
||||
|
||||
@@ -10,7 +10,8 @@ describe("SubjectDetail medication adherence", () => {
|
||||
|
||||
expect(source).toContain('name="medicationAdherence"');
|
||||
expect(source).toContain("actual_medication_count");
|
||||
expect(source).toContain("保存用药次数");
|
||||
expect(source).toContain("saveMedicationAdherence");
|
||||
expect(source).toContain("<div class=\"editor-title\">用药依从性</div>");
|
||||
expect(source).toContain("实际用药次数为试验期间实际药物暴露次数");
|
||||
expect(source).toContain("75%~125% 范围内(包含边界值)");
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user