fix: preserve monitor check catalog titles
This commit is contained in:
@@ -1220,10 +1220,13 @@ if (expectedErrorId) {
|
||||
const dialog = document.querySelector("[data-check-dialog='true']");
|
||||
const dialogErrorId = dialog?.getAttribute("data-error-id") || "";
|
||||
const title = String(document.querySelector("#check-dialog-title")?.textContent || "").replace(/\s+/g, " ").trim();
|
||||
if (dialog instanceof HTMLElement && dialogErrorId === errorId && title && title !== "未登记监测项") return { requestedErrorId: errorId, ok: true, reason: "dialog-open-registered" };
|
||||
const row = document.querySelector('[data-error-id="' + CSS.escape(errorId) + '"]');
|
||||
if (row instanceof HTMLElement) row.click();
|
||||
await wait(150);
|
||||
const dialogMatches = dialog instanceof HTMLElement && dialogErrorId === errorId;
|
||||
if (dialogMatches && title && title !== "未登记监测项") return { requestedErrorId: errorId, ok: true, reason: "dialog-open-registered" };
|
||||
if (!dialogMatches) {
|
||||
const row = document.querySelector('[data-error-id="' + CSS.escape(errorId) + '"]');
|
||||
if (row instanceof HTMLElement) row.click();
|
||||
}
|
||||
await wait(250);
|
||||
}
|
||||
return { requestedErrorId: errorId, ok: false, reason: "dialog-missing" };
|
||||
}, expectedErrorId).catch((error) => ({ requestedErrorId: expectedErrorId, ok: false, reason: "selection-error", error: String(error?.message || error).slice(0, 300) }));
|
||||
|
||||
Reference in New Issue
Block a user