WF8-10 移动审批展示处理历史
这个提交包含在:
@@ -143,6 +143,27 @@ function workflowStatusLabel(status: string) {
|
||||
return status;
|
||||
}
|
||||
|
||||
function workflowActionLabel(action: string | null | undefined) {
|
||||
if (!action) {
|
||||
return "-";
|
||||
}
|
||||
|
||||
const labels: Record<string, string> = {
|
||||
submit: "提交",
|
||||
approve: "通过",
|
||||
reject: "驳回",
|
||||
return: "退回",
|
||||
transfer: "转审",
|
||||
withdraw: "撤回",
|
||||
remind: "催办",
|
||||
overdue_remind: "超时提醒",
|
||||
cancel: "取消",
|
||||
skip: "跳过",
|
||||
};
|
||||
|
||||
return labels[action] ?? action;
|
||||
}
|
||||
|
||||
function businessStatusLabel(status: string | null | undefined) {
|
||||
const labels: Record<string, string> = {
|
||||
draft: "草稿",
|
||||
@@ -1322,6 +1343,26 @@ export function MobileApprovalsPage() {
|
||||
) : null}
|
||||
</div>
|
||||
|
||||
<div className="space-y-2" data-testid="mobile-approvals-history">
|
||||
<div className="flex items-center justify-between gap-3">
|
||||
<h4 className="text-sm font-semibold text-zinc-900">处理历史</h4>
|
||||
<span className="text-xs text-zinc-500">{selectedTask.history.length} 条</span>
|
||||
</div>
|
||||
{selectedTask.history.length ? (
|
||||
selectedTask.history.map((item) => (
|
||||
<article className="mobile-list-card text-sm" data-testid="mobile-approvals-history-item" key={item.id}>
|
||||
<div className="font-medium text-zinc-900">
|
||||
{workflowActionLabel(item.action)} · {item.actorName || item.actorEmployeeNo || item.actorId}
|
||||
</div>
|
||||
<div className="mt-1 text-zinc-600">{item.comment || "-"}</div>
|
||||
<div className="mt-1 text-xs text-zinc-500">{formatDateTime(item.createdAt)}</div>
|
||||
</article>
|
||||
))
|
||||
) : (
|
||||
<p className="text-sm text-zinc-500">暂无历史记录</p>
|
||||
)}
|
||||
</div>
|
||||
|
||||
{!selectedTaskAllowsActions ? (
|
||||
<p className="rounded-lg border border-zinc-200 bg-zinc-50 px-3 py-2 text-sm text-zinc-600">
|
||||
当前任务已处理,仅供查看,不支持再次审批。
|
||||
|
||||
@@ -272,6 +272,31 @@ function workflowTaskSummary(status: "pending" | "completed" = "pending") {
|
||||
|
||||
function workflowTaskDetail(status: "pending" | "completed" = "pending") {
|
||||
const isCompleted = status === "completed";
|
||||
const history = [
|
||||
{
|
||||
id: "history-workflow-submit-dg7",
|
||||
taskId: null,
|
||||
actorId: "employee-dg7-employee",
|
||||
actorName: "测试员工",
|
||||
actorEmployeeNo: "E-DG7",
|
||||
action: "submit",
|
||||
comment: "提交审批",
|
||||
payload: null,
|
||||
createdAt: "2026-05-12T08:00:00.000Z",
|
||||
},
|
||||
{
|
||||
id: isCompleted ? "history-workflow-approve-dg7" : "history-workflow-transfer-dg7",
|
||||
taskId: isCompleted ? "task-dg7-completed" : "task-dg7",
|
||||
actorId: "employee-dg7-manager",
|
||||
actorName: "测试审批人",
|
||||
actorEmployeeNo: "M-DG7",
|
||||
action: isCompleted ? "approve" : "transfer",
|
||||
comment: isCompleted ? "同意报销" : "转给财务复核",
|
||||
payload: isCompleted ? null : { transferToEmployeeId: "employee-dg7-finance" },
|
||||
createdAt: isCompleted ? "2026-05-12T09:00:00.000Z" : "2026-05-12T08:30:00.000Z",
|
||||
},
|
||||
];
|
||||
|
||||
return {
|
||||
task: {
|
||||
id: isCompleted ? "task-dg7-completed" : "task-dg7",
|
||||
@@ -309,7 +334,7 @@ function workflowTaskDetail(status: "pending" | "completed" = "pending") {
|
||||
purchaseRequest: null,
|
||||
travelRequest: null,
|
||||
allowedActions: isCompleted ? [] : ["approve", "reject", "return", "transfer"],
|
||||
history: [],
|
||||
history,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -874,6 +899,9 @@ test.describe("MIF7 移动信息架构整改", () => {
|
||||
await expect(mobile.page.getByTestId("mobile-bottom-nav")).toHaveCount(0);
|
||||
await expect(mobile.page.getByTestId("mobile-approvals-detail")).not.toContainText("业务单号");
|
||||
await expect(mobile.page.getByTestId("mobile-approvals-detail")).toContainText("报销单 BX20260512001");
|
||||
await expect(mobile.page.getByTestId("mobile-approvals-history")).toContainText("提交 · 测试员工");
|
||||
await expect(mobile.page.getByTestId("mobile-approvals-history")).toContainText("转审 · 测试审批人");
|
||||
await expect(mobile.page.getByTestId("mobile-approvals-history")).not.toContainText("transferToEmployeeId");
|
||||
await expectNoMobileShellRegression(mobile.page);
|
||||
await mobile.page.screenshot({ path: screenshotPath("manager-approval-push-detail"), fullPage: true });
|
||||
|
||||
|
||||
在新工单中引用
屏蔽一个用户