Files
claw/tests/fixtures/generated_scene/paginated_enrichment_expansion/index.html

61 lines
1.6 KiB
HTML

<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Paginated Enrichment Expansion Fixture</title>
</head>
<body>
<script>
const sourceUrl = "http://yx.gs.sgcc.com.cn";
async function getTicketList(pageNum, pageSize) {
return $.ajax({
url: "http://yx.gs.sgcc.com.cn/workorder/ticketList",
type: "POST",
contentType: "application/json",
data: JSON.stringify({ pageNum, pageSize, sourceTypes: ["95598", "12398"] })
});
}
async function getTicketRiskDetail(ticketNo) {
return $.ajax({
url: "http://yx.gs.sgcc.com.cn/workorder/ticketRiskDetail",
type: "POST",
contentType: "application/json",
data: JSON.stringify({ ticketNo })
});
}
async function executeTask() {
const pageSize = 50;
let pageNum = 1;
const rows = [];
while (pageNum < 20) {
const response = await getTicketList(pageNum, pageSize);
const list = response.rows || [];
if (!list.length) break;
for (const item of list) {
const detail = await getTicketRiskDetail(item.ticketNo);
const row = { ...item, riskLevel: detail.riskLevel };
if (row.riskLevel !== "LOW") {
rows.push(row);
}
}
pageNum += 1;
}
const aggregated = rows.map(row => ({
ticketNo: row.ticketNo,
riskLevel: row.riskLevel,
sourceType: row.sourceType
}));
exportExcel(aggregated);
return aggregated;
}
function exportExcel(rows) {
return rows.length;
}
</script>
</body>
</html>