收敛历史导入文件前端只读展示
This commit is contained in:
@@ -71,3 +71,10 @@
|
||||
- 接入 `listHistoryProjects` 与 `importFromHistory` 真实接口,提交时按计划组装 `projectName/description/sourceProjectIds/startDate/endDate`
|
||||
- 新增 `project-import-history-dialog-layout.test.js` 与 `project-import-history-dialog-behavior.test.js`,锁定备注字段、日期范围、多选语义、真实接口调用与 `response.data` 回传
|
||||
- 验证命令:`cd ruoyi-ui && node tests/unit/project-import-history-dialog-layout.test.js && node tests/unit/project-import-history-dialog-behavior.test.js`
|
||||
|
||||
### 2026-03-29 Task 3 前端上传记录来源与只读规则
|
||||
|
||||
- 在 `UploadData.vue` 的文件列表中增加“来源”列,历史导入记录显示为“历史导入 · 来源项目名”
|
||||
- 将 `uploadFileActionRules.js` 改为按整行判断动作,对 `sourceType = HISTORY_IMPORT` 的记录直接返回 `null`,隐藏删除入口
|
||||
- 新增 `upload-data-history-import-readonly.test.js`,并扩展现有文件列表与删除文案测试,锁定来源字段与历史导入只读规则
|
||||
- 验证命令:`cd ruoyi-ui && node tests/unit/upload-data-file-list-table.test.js && node tests/unit/upload-data-delete-retag-copy.test.js && node tests/unit/upload-data-history-import-readonly.test.js`
|
||||
|
||||
@@ -71,6 +71,14 @@
|
||||
{{ scope.row.accountNos || '-' }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="sourceProjectName" label="来源" min-width="180">
|
||||
<template slot-scope="scope">
|
||||
<span v-if="scope.row.sourceType === 'HISTORY_IMPORT'">
|
||||
历史导入 · {{ scope.row.sourceProjectName || '-' }}
|
||||
</span>
|
||||
<span v-else>-</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="uploadTime" label="上传时间" width="180">
|
||||
<template slot-scope="scope">
|
||||
{{ formatUploadTime(scope.row.uploadTime) }}
|
||||
@@ -820,7 +828,7 @@ export default {
|
||||
},
|
||||
|
||||
getRowAction(row) {
|
||||
return getUploadFileAction(row.fileStatus);
|
||||
return getUploadFileAction(row);
|
||||
},
|
||||
|
||||
handleRowAction(row) {
|
||||
|
||||
@@ -1,10 +1,14 @@
|
||||
export function getUploadFileAction(status) {
|
||||
export function getUploadFileAction(row) {
|
||||
if (row.sourceType === "HISTORY_IMPORT") {
|
||||
return null
|
||||
}
|
||||
|
||||
const actionMap = {
|
||||
parsed_failed: { key: "viewError", text: "查看错误原因" },
|
||||
parsed_success: { key: "delete", text: "删除" }
|
||||
};
|
||||
}
|
||||
|
||||
return actionMap[status] || null;
|
||||
return actionMap[row.fileStatus] || null
|
||||
}
|
||||
|
||||
export function getUploadFileStatusText(status) {
|
||||
@@ -14,9 +18,9 @@ export function getUploadFileStatusText(status) {
|
||||
parsed_success: "解析成功",
|
||||
parsed_failed: "解析失败",
|
||||
deleted: "已删除"
|
||||
};
|
||||
}
|
||||
|
||||
return map[status] || status;
|
||||
return map[status] || status
|
||||
}
|
||||
|
||||
export function getUploadFileStatusType(status) {
|
||||
@@ -26,7 +30,7 @@ export function getUploadFileStatusType(status) {
|
||||
parsed_success: "success",
|
||||
parsed_failed: "danger",
|
||||
deleted: "info"
|
||||
};
|
||||
|
||||
return map[status] || "info";
|
||||
}
|
||||
|
||||
return map[status] || "info"
|
||||
}
|
||||
|
||||
@@ -6,7 +6,12 @@ const componentPath = path.resolve(
|
||||
__dirname,
|
||||
"../../src/views/ccdiProject/components/detail/UploadData.vue"
|
||||
);
|
||||
const actionRulePath = path.resolve(
|
||||
__dirname,
|
||||
"../../src/views/ccdiProject/components/detail/uploadFileActionRules.js"
|
||||
);
|
||||
const source = fs.readFileSync(componentPath, "utf8");
|
||||
const actionRuleSource = fs.readFileSync(actionRulePath, "utf8");
|
||||
|
||||
assert(
|
||||
/删除[^"]*重新打标[^"]*是否继续/.test(source),
|
||||
@@ -18,4 +23,6 @@ assert(
|
||||
"删除成功提示应明确告知已开始项目重新打标"
|
||||
);
|
||||
|
||||
assert(actionRuleSource.includes("HISTORY_IMPORT"), "上传记录操作规则应识别历史导入来源");
|
||||
|
||||
console.log("upload-data-delete-retag-copy test passed");
|
||||
|
||||
@@ -34,4 +34,7 @@ assert(
|
||||
"文件上传列表表头应移除自定义颜色,仅保留基础字重"
|
||||
);
|
||||
|
||||
assert(source.includes("sourceProjectName"), "文件列表应展示来源项目名称字段");
|
||||
assert(source.includes("历史导入"), "文件列表应展示历史导入来源文案");
|
||||
|
||||
console.log("upload-data-file-list-table test passed");
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
const assert = require("assert");
|
||||
const fs = require("fs");
|
||||
const path = require("path");
|
||||
|
||||
const actionRulePath = path.resolve(
|
||||
__dirname,
|
||||
"../../src/views/ccdiProject/components/detail/uploadFileActionRules.js"
|
||||
);
|
||||
const actionRuleSource = fs.readFileSync(actionRulePath, "utf8");
|
||||
|
||||
assert(
|
||||
/if\s*\(row\.sourceType\s*===\s*["']HISTORY_IMPORT["']\)\s*\{\s*return null/.test(actionRuleSource),
|
||||
"历史导入文件应直接隐藏删除入口"
|
||||
);
|
||||
|
||||
console.log("upload-data-history-import-readonly test passed");
|
||||
Reference in New Issue
Block a user