移除示例项目初始化并修复前后端稳定性问题

This commit is contained in:
Cheng Zhou
2026-03-30 15:35:22 +08:00
parent a67991740e
commit 8c5d03f1cb
24 changed files with 581 additions and 102 deletions
@@ -0,0 +1,80 @@
import { describe, expect, it } from "vitest";
import { readFileSync } from "node:fs";
import { resolve } from "node:path";
const readView = (relativePath: string) =>
readFileSync(resolve(__dirname, relativePath), "utf8");
const normalizeWhitespace = (source: string) => source.replace(/\s+/g, " ").trim();
describe("route view overlays are mounted only when visible", () => {
it("gates high-risk admin and subject overlays behind visible flags", () => {
const checks = [
{
file: "./admin/ProjectMembers.vue",
snippets: ['<el-dialog v-if="addVisible"', 'v-model="addVisible"'],
},
{
file: "./admin/Sites.vue",
snippets: ['<SiteForm', 'v-if="projectId && formVisible"'],
},
{
file: "./admin/SiteForm.vue",
snippets: ['<el-dialog v-if="visibleProxy"', 'v-model="visibleProxy"'],
},
{
file: "./admin/SiteCraBinding.vue",
snippets: ['<el-dialog v-if="visibleProxy"', 'v-model="visibleProxy"'],
},
{
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"',
],
},
{
file: "./ia/ProjectMilestones.vue",
snippets: ['<el-drawer v-if="editorVisible"', 'v-model="editorVisible"'],
},
{
file: "./ia/MaterialEquipment.vue",
snippets: ['<el-drawer v-if="drawerVisible"', 'v-model="drawerVisible"'],
},
{
file: "./ia/RiskIssueMonitoringVisits.vue",
snippets: [
'<el-drawer v-if="formDialogVisible"',
'v-model="formDialogVisible"',
'<el-dialog v-if="viewDialogVisible"',
'v-model="viewDialogVisible"',
],
},
{
file: "./admin/ProjectDetail.vue",
snippets: [
'<el-dialog v-if="publishConfirmVisible"',
'v-model="publishConfirmVisible"',
'v-if="rollbackDialogVisible"',
'v-model="rollbackDialogVisible"',
'<el-drawer v-if="projectMilestoneEditorVisible"',
'<el-drawer v-if="siteMilestoneEditorVisible"',
'<el-drawer v-if="siteEnrollmentEditorVisible"',
'<el-drawer v-if="monitoringStrategyEditorVisible"',
'const getRollbackAxisLeftStyle = (axisX?: number | null) => ({',
':style="getRollbackAxisLeftStyle(lane.x)"',
':style="getRollbackAxisLeftStyle(row.axisX)"',
],
},
];
for (const check of checks) {
const source = normalizeWhitespace(readView(check.file));
for (const snippet of check.snippets) {
expect(source, `${check.file} should include ${snippet}`).toContain(normalizeWhitespace(snippet));
}
}
});
});