重构财务台账工具与异常优先页面(05-30-finance-ledger-tools-redesign)

这个提交包含在:
2026-05-30 12:22:06 +08:00
父节点 c4edb12bb8
当前提交 51a1347827
共修改 17 个文件,包含 305 行新增和 117 行删除
@@ -1129,7 +1129,7 @@ test(`${trialrunIssueId} 浏览器业务先行试运行:报销、审批、请
const finance = await loginRole(page, "finance");
await page.goto("/ap-operations");
await expect(page.getByRole("heading", { name: /AP 运营|财务付款与对账/ }).first()).toBeVisible();
await expect(page.getByRole("heading", { name: "应付账款", exact: true })).toBeVisible();
if (await page.getByText(/当前功能未启用/).first().isVisible().catch(() => false)) {
return {
status: "SKIP",
@@ -1158,17 +1158,18 @@ test(`${trialrunIssueId} 浏览器业务先行试运行:报销、审批、请
const batchName = `${trialrunMarkerPrefix} 浏览器付款批次 ${marker}`;
state.paymentBatchName = batchName;
await page.goto("/payment-batches");
await expect(page.getByRole("heading", { name: "支付批次", exact: true })).toBeVisible();
await expect(page.getByRole("heading", { name: "付款", exact: true })).toBeVisible();
if (await page.getByText(/当前功能未启用/).first().isVisible().catch(() => false)) {
return {
status: "SKIP",
businessId: state.reimbursementCode ?? state.reimbursementId,
pcResult: "SKIP: 支付批次功能开关未启用",
pcResult: "SKIP: 付款批次功能开关未启用",
conclusion: "暂停",
detail: "报销审批已完成;/payment-batches 返回当前功能未启用,未创建付款批次或执行付款。",
};
}
const createCard = page.locator(".card-std").filter({ hasText: "新建批次" }).first();
await page.getByRole("button", { name: "台账工具" }).click();
const createCard = page.getByTestId("payment-batch-create-panel");
await expect(createCard.getByRole("button", { name: "创建批次" })).toBeEnabled();
const createBatchResponsePromise = page.waitForResponse((response) => {
const url = new URL(response.url());
@@ -1176,19 +1177,19 @@ test(`${trialrunIssueId} 浏览器业务先行试运行:报销、审批、请
});
await createCard.locator("select").nth(0).selectOption("reimbursement");
await createCard.getByPlaceholder("例如:2026Q2-财务付款批次-01").fill(batchName);
await createCard.getByPlaceholder("用逗号或换行分隔 reimbursement / travel_order ID").fill(state.reimbursementId);
await createCard.getByPlaceholder("输入报销或差旅待付款单据 ID,多个用逗号或换行分隔").fill(state.reimbursementId);
await createCard.locator('input[type="date"]').fill(new Date().toISOString().slice(0, 10));
await createCard.locator("select").nth(1).selectOption("bank");
await createCard.getByPlaceholder("例如 PBX").fill(`${trialrunSafePrefix}-${marker.slice(-6)}`);
await createCard.getByRole("button", { name: "创建批次" }).click();
const createBatchResponse = await createBatchResponsePromise;
if (!createBatchResponse.ok()) {
throw new Error(`创建支付批次失败:HTTP ${createBatchResponse.status()} ${await createBatchResponse.text()}`);
throw new Error(`创建付款批次失败:HTTP ${createBatchResponse.status()} ${await createBatchResponse.text()}`);
}
const createBatchPayload = (await createBatchResponse.json()) as { data?: { item?: PaymentBatch } };
const batch = createBatchPayload.data?.item;
if (!batch?.id) {
throw new Error(`创建支付批次后未返回 id: ${JSON.stringify(createBatchPayload)}`);
throw new Error(`创建付款批次后未返回 id: ${JSON.stringify(createBatchPayload)}`);
}
state.paymentBatchId = batch.id;
await logoutLiveUser(page, { name: finance.name }).catch(() => undefined);