实现流程项目逻辑删除与恢复

This commit is contained in:
wkc
2026-07-02 10:54:36 +08:00
parent 2f53fc4d1e
commit 57a33098c9
27 changed files with 690 additions and 97 deletions

View File

@@ -10,6 +10,46 @@ const dialogPath = path.resolve(
const pageSource = fs.readFileSync(pagePath, "utf8");
const dialogSource = fs.readFileSync(dialogPath, "utf8");
assert(
pageSource.includes("delProject") && pageSource.includes("restoreProject"),
"项目列表页应引入删除和恢复接口"
);
assert(
pageSource.includes("includeDeleted: false"),
"默认查询参数应不包含已删除项目"
);
assert(
pageSource.includes(':show-deleted-tab="isProjectAdmin"'),
"已删除入口应仅对项目管理员角色展示"
);
assert(
pageSource.includes("'5': counts.status5 || 0"),
"状态统计应接入已删除数量"
);
assert(
pageSource.includes('await delProject(row.projectId)'),
"删除确认后应调用项目删除接口"
);
assert(
pageSource.includes('await restoreProject(row.projectId)'),
"恢复确认后应调用项目恢复接口"
);
assert(
pageSource.includes("项目内数据不会删除"),
"删除确认文案应明确项目内数据不会删除"
);
assert(
pageSource.includes("项目将恢复为已完成状态"),
"恢复确认文案应明确恢复到已完成状态"
);
assert(
pageSource.includes("await archiveProject(data.projectId)"),
"确认归档后应调用真实归档接口"

View File

@@ -6,6 +6,48 @@ const pagePath = path.resolve(__dirname, "../../src/views/ccdiProject/index.vue"
const tablePath = path.resolve(__dirname, "../../src/views/ccdiProject/components/ProjectTable.vue");
const pageSource = fs.readFileSync(pagePath, "utf8");
const tableSource = fs.readFileSync(tablePath, "utf8");
const searchBarPath = path.resolve(__dirname, "../../src/views/ccdiProject/components/SearchBar.vue");
const searchBarSource = fs.readFileSync(searchBarPath, "utf8");
assert(
searchBarSource.includes("{ label: '已删除', value: 'deleted'"),
"搜索条应提供独立的已删除列表入口"
);
assert(
searchBarSource.includes("tab.value !== 'deleted' || this.showDeletedTab"),
"已删除入口应由 showDeletedTab 控制可见性"
);
assert(
searchBarSource.includes("const includeDeleted = this.activeTab === 'deleted'"),
"切换已删除入口时应生成 includeDeleted 查询态"
);
assert(
searchBarSource.includes("status: includeDeleted || this.activeTab === 'all' ? null : this.activeTab"),
"已删除列表不应和普通状态 tab 混用"
);
assert(
tableSource.includes('v-if="deletedList"'),
"删除列表应使用独立操作区"
);
assert(
tableSource.includes('@click="handleRestore(scope.row)"'),
"删除列表应提供恢复按钮"
);
assert(
tableSource.includes('v-if="canDelete(scope.row) && scope.row.status !== \'5\'"'),
"普通列表应按 canDelete 展示删除按钮且排除已删除状态"
);
assert(
/<template v-if="deletedList">[\s\S]*?handleRestore\(scope\.row\)[\s\S]*?<\/template>\s*<template v-else>[\s\S]*?handleViewResult/.test(tableSource),
"删除列表只展示恢复动作,进入项目和查看结果应留在普通列表分支"
);
assert(
pageSource.includes("rebuildProjectTags({ projectId: row.projectId })"),

View File

@@ -23,5 +23,14 @@ assert(
!source.includes("::v-deep .el-table"),
"项目列表不应继续保留自定义深度表格皮肤"
);
assert(
source.includes('class="delete-button"'),
"项目列表删除按钮应使用独立红色样式类"
);
assert(
source.includes("::v-deep .el-button--text.delete-button") &&
source.includes("color: #f56c6c"),
"项目列表删除按钮应渲染为红色"
);
console.log("project-table-style test passed");