实现项目归档功能
This commit is contained in:
42
ruoyi-ui/tests/unit/project-archive-readonly-guard.test.js
Normal file
42
ruoyi-ui/tests/unit/project-archive-readonly-guard.test.js
Normal file
@@ -0,0 +1,42 @@
|
||||
const assert = require("assert");
|
||||
const fs = require("fs");
|
||||
const path = require("path");
|
||||
|
||||
const uploadPath = path.resolve(
|
||||
__dirname,
|
||||
"../../src/views/ccdiProject/components/detail/UploadData.vue"
|
||||
);
|
||||
const paramPath = path.resolve(
|
||||
__dirname,
|
||||
"../../src/views/ccdiProject/components/detail/ParamConfig.vue"
|
||||
);
|
||||
const uploadSource = fs.readFileSync(uploadPath, "utf8");
|
||||
const paramSource = fs.readFileSync(paramPath, "utf8");
|
||||
|
||||
assert(
|
||||
uploadSource.includes('return String(this.projectInfo.projectStatus) === "2";'),
|
||||
"上传数据页应声明归档态判断"
|
||||
);
|
||||
|
||||
assert(
|
||||
/if\s*\(this\.isProjectTagging\s*\|\|\s*this\.isProjectArchived\)/.test(uploadSource),
|
||||
"上传数据页的操作入口应同时拦截打标中和已归档"
|
||||
);
|
||||
|
||||
assert(
|
||||
paramSource.includes('return String(this.projectInfo.projectStatus) === "2";'),
|
||||
"参数配置页应声明归档态判断"
|
||||
);
|
||||
|
||||
assert(
|
||||
paramSource.includes("已归档项目暂不可修改参数"),
|
||||
"参数配置页应展示归档态只读提示"
|
||||
);
|
||||
|
||||
assert(
|
||||
/:disabled="isProjectTagging \|\| isProjectArchived \|\| saving"/.test(paramSource) ||
|
||||
/:disabled="isProjectTagging \|\| isProjectArchived"/.test(paramSource),
|
||||
"参数保存入口应在归档态下禁用"
|
||||
);
|
||||
|
||||
console.log("project-archive-readonly-guard test passed");
|
||||
40
ruoyi-ui/tests/unit/project-detail-archive-tab-lock.test.js
Normal file
40
ruoyi-ui/tests/unit/project-detail-archive-tab-lock.test.js
Normal file
@@ -0,0 +1,40 @@
|
||||
const assert = require("assert");
|
||||
const fs = require("fs");
|
||||
const path = require("path");
|
||||
|
||||
const componentPath = path.resolve(
|
||||
__dirname,
|
||||
"../../src/views/ccdiProject/detail.vue"
|
||||
);
|
||||
const source = fs.readFileSync(componentPath, "utf8");
|
||||
|
||||
assert(
|
||||
source.includes('index="upload"') &&
|
||||
source.includes(`:disabled="isArchiveLockedTab('upload')"`) &&
|
||||
source.includes('index="config"') &&
|
||||
source.includes(`:disabled="isArchiveLockedTab('config')"`),
|
||||
"上传数据和参数配置页签应支持归档态禁用"
|
||||
);
|
||||
|
||||
assert(
|
||||
/isProjectArchived\(\)\s*\{\s*return String\(this\.projectInfo\.projectStatus\) === "2";\s*\}/.test(
|
||||
source
|
||||
),
|
||||
"详情页应声明归档态判断"
|
||||
);
|
||||
|
||||
assert(
|
||||
/initActiveTabFromRoute\(\)\s*\{[\s\S]*?this\.resolveAccessibleTab\(targetTab\)/.test(
|
||||
source
|
||||
),
|
||||
"详情页应在路由初始化时校正归档态不可访问页签"
|
||||
);
|
||||
|
||||
assert(
|
||||
/handleMenuSelect\(index\)\s*\{[\s\S]*?if\s*\(this\.isArchiveLockedTab\(index\)\)\s*\{\s*return;\s*\}/.test(
|
||||
source
|
||||
),
|
||||
"点击禁用页签时不应切换"
|
||||
);
|
||||
|
||||
console.log("project-detail-archive-tab-lock test passed");
|
||||
43
ruoyi-ui/tests/unit/project-list-archive-flow.test.js
Normal file
43
ruoyi-ui/tests/unit/project-list-archive-flow.test.js
Normal file
@@ -0,0 +1,43 @@
|
||||
const assert = require("assert");
|
||||
const fs = require("fs");
|
||||
const path = require("path");
|
||||
|
||||
const pagePath = path.resolve(__dirname, "../../src/views/ccdiProject/index.vue");
|
||||
const dialogPath = path.resolve(
|
||||
__dirname,
|
||||
"../../src/views/ccdiProject/components/ArchiveConfirmDialog.vue"
|
||||
);
|
||||
const pageSource = fs.readFileSync(pagePath, "utf8");
|
||||
const dialogSource = fs.readFileSync(dialogPath, "utf8");
|
||||
|
||||
assert(
|
||||
pageSource.includes("await archiveProject(data.projectId)"),
|
||||
"确认归档后应调用真实归档接口"
|
||||
);
|
||||
|
||||
assert(
|
||||
pageSource.includes('this.$modal.msgSuccess("项目归档成功")') ||
|
||||
pageSource.includes("this.$modal.msgSuccess('项目归档成功')"),
|
||||
"归档成功后应提示项目归档成功"
|
||||
);
|
||||
|
||||
assert(
|
||||
pageSource.includes("项目归档失败,请稍后重试"),
|
||||
"归档失败时应有统一兜底提示"
|
||||
);
|
||||
|
||||
[
|
||||
"自动生成项目报告PDF",
|
||||
"移入归档库,可随时查看",
|
||||
"同时删除项目相关数据",
|
||||
"归档后可从\"归档库\"中查看和恢复",
|
||||
].forEach((token) => {
|
||||
assert(!dialogSource.includes(token), `归档弹窗不应保留超范围文案: ${token}`);
|
||||
});
|
||||
|
||||
assert(
|
||||
!dialogSource.includes("deleteData"),
|
||||
"归档弹窗不应再保留删除数据状态"
|
||||
);
|
||||
|
||||
console.log("project-list-archive-flow test passed");
|
||||
@@ -23,10 +23,10 @@ assert(
|
||||
);
|
||||
|
||||
assert(
|
||||
/syncUploadCardDisabledState\(\)\s*\{[\s\S]*?card\.key === "transaction"[\s\S]*?disabled:\s*this\.isProjectTagging/.test(
|
||||
/syncUploadCardDisabledState\(\)\s*\{[\s\S]*?card\.key === "transaction"[\s\S]*?disabled:\s*this\.isProjectTagging\s*\|\|\s*this\.isProjectArchived/.test(
|
||||
source
|
||||
),
|
||||
"流水导入卡片应在项目打标中时同步置灰"
|
||||
"流水导入卡片应在项目打标中或已归档时同步置灰"
|
||||
);
|
||||
|
||||
assert(
|
||||
|
||||
Reference in New Issue
Block a user