fix: 收窄详情按钮并校正响应式回归(09-04-reimbursement-state-gap-finance-view)

这个提交包含在:
2026-09-11 20:21:45 +08:00
父节点 fedcaed1a1
当前提交 9e41f107fa
共修改 9 个文件,包含 202 行新增和 14 行删除
@@ -676,9 +676,12 @@ test.describe("报销付款交接一致性", () => {
await page.goto(`${mobile ? "/mobile" : ""}/reimbursements/${reimbursementId}`);
const actions = page.getByTestId(mobile ? "mobile-reimbursement-payment-actions" : "reimbursement-action-panel");
await expect(actions).toContainText("已生成银行制单,等待付款完成并上传回单");
await expect(page.getByText("去组建付款批次", { exact: true })).toHaveCount(0);
await expect(page.getByRole("link", { name: "创建批次", exact: true })).toHaveCount(0);
const link = page.getByRole("link", { name: "查看所在付款批次", exact: true });
await expect(link).toHaveCount(1);
const linkBounds = await link.boundingBox();
expect(linkBounds!.height).toBeGreaterThanOrEqual(44);
if (!mobile) expect(linkBounds!.width).toBeLessThan(180);
await link.click();
await expect(page.getByTestId("payment-batch-processing-panel")).toBeVisible();
await page.goBack();
@@ -695,6 +698,34 @@ test.describe("报销付款交接一致性", () => {
});
}
for (const width of [1280, 1440]) {
test(`桌面${width}创建批次按钮短文案按内容宽度且只导航不组批`, async ({ page }, testInfo) => {
await page.setViewportSize({ width, height: 960 });
await mockSystemActionApis(page, { reimbursementStatus: "approved", reimbursementProgress: () => progress("none") });
let batchWrites = 0;
page.on("request", (request) => {
if (new URL(request.url()).pathname === "/api/payment-batches" && request.method() === "POST") batchWrites += 1;
});
await login(page, user);
await page.goto(`/reimbursements/${reimbursementId}`);
const button = page.getByRole("link", { name: "创建批次", exact: true });
await expect(button).toBeVisible();
const actions = page.getByTestId("reimbursement-action-panel");
const buttonBounds = await button.boundingBox();
const actionBounds = await actions.boundingBox();
expect(buttonBounds!.width).toBeGreaterThanOrEqual(44);
expect(buttonBounds!.width).toBeLessThan(160);
expect(buttonBounds!.width).toBeLessThan(actionBounds!.width * 0.7);
expect(buttonBounds!.height).toBeGreaterThanOrEqual(44);
expect(Math.abs(buttonBounds!.x - actionBounds!.x)).toBeLessThan(2);
expect(await page.evaluate(() => document.documentElement.scrollWidth <= innerWidth + 2)).toBe(true);
await actions.locator("..").screenshot({ path: testInfo.outputPath("compact-payment-action.png") });
await button.click();
await expect(page).toHaveURL(/\/payment-batches\?view=pending&q=/);
expect(batchWrites).toBe(0);
});
}
for (const [status, expected] of [
["none", "待财务组建付款批次"], ["draft", "待非制单人复核付款"],
["reviewed", "已生成银行制单"], ["failed", "付款登记失败"],
@@ -709,6 +740,7 @@ test.describe("报销付款交接一致性", () => {
await page.goto(`/reimbursements/${reimbursementId}`);
await expect(page.getByTestId("reimbursement-action-panel")).toContainText(expected);
await expect(page.getByRole("link", { name: /付款批次/ })).toHaveCount(0);
await expect(page.getByTestId("reimbursement-open-pending-payment-batches")).toHaveCount(0);
});
}
@@ -941,11 +973,17 @@ test.describe("R7E 全站高风险操作二次确认", () => {
const progress = page.getByTestId("payment-batch-processing-panel");
await expect(progress).toBeVisible();
expect(await progress.evaluate((element) => Boolean(element.previousElementSibling?.querySelector('[data-testid="payment-batch-action-panel"]')))).toBe(true);
const actionBounds = await sideActions.boundingBox();
const actionBounds = await actions.boundingBox();
const progressBounds = await progress.boundingBox();
expect(actionBounds).not.toBeNull();
expect(progressBounds).not.toBeNull();
expect(progressBounds!.y).toBeGreaterThanOrEqual(actionBounds!.y + actionBounds!.height);
if (mobile) {
await expect(sideActions).toBeHidden();
expect(await actions.evaluate((element) => getComputedStyle(element).position)).toBe("fixed");
expect(actionBounds!.height).toBeGreaterThanOrEqual(44);
} else {
expect(progressBounds!.y).toBeGreaterThanOrEqual(actionBounds!.y + actionBounds!.height);
}
expect(await page.evaluate(() => document.documentElement.scrollWidth <= window.innerWidth)).toBe(true);
await page.screenshot({ path: testInfo.outputPath("before-payment-order.png"), fullPage: true });
await actions.getByTestId("payment-batch-action-downloadOrder").click();
@@ -1142,25 +1180,33 @@ test.describe("R7E 全站高风险操作二次确认", () => {
await login(page, user);
await page.goto(`/reimbursements/${reimbursementId}`);
const attachment = page.locator(".detail-evidence-card").filter({ hasText: "合成报销敏感附件.pdf" });
const attachment = page.getByTestId("approval-attachments").locator(":scope > div").filter({
has: page.getByRole("button", { name: "查看补充附件:合成报销敏感附件.pdf", exact: true }),
});
await expect(attachment).toBeVisible();
await attachment.getByRole("button", { name: "删除" }).click();
await attachment.getByRole("button", { name: "删除附件", exact: true }).click();
const dialog = page.getByTestId("attachment-delete-confirm-dialog");
await expect(dialog).toContainText("合成报销敏感附件.pdf");
await expect(dialog).toContainText("无法在 OA 内恢复");
expect(calls.deleteReimbursementAttachment).toBe(0);
await page.getByTestId("attachment-delete-confirm-submit").click();
await expect(dialog).toContainText("请填写至少 2 个字的删除理由");
expect(calls.deleteReimbursementAttachment).toBe(0);
await dialog.getByRole("textbox", { name: "删除理由" }).fill("一");
await page.getByTestId("attachment-delete-confirm-submit").click();
await expect(dialog).toContainText("请填写至少 2 个字的删除理由");
expect(calls.deleteReimbursementAttachment).toBe(0);
await dialog.getByRole("button", { name: "取消" }).click();
await expect(dialog).not.toBeVisible();
expect(calls.deleteReimbursementAttachment).toBe(0);
await attachment.getByRole("button", { name: "删除" }).click();
await attachment.getByRole("button", { name: "删除附件", exact: true }).click();
await page.getByRole("textbox", { name: "删除理由" }).fill("附件重复上传");
await page.getByTestId("attachment-delete-confirm-submit").click();
await expect.poll(() => calls.deleteReimbursementAttachment).toBe(1);
expect(calls.attachmentDeleteReasons).toEqual(["附件重复上传"]);
await expect(dialog).not.toBeVisible();
});
test("付款回单作废要求对象、后果和理由,取消与理由不足均为零请求", async ({ page }) => {