Files
menchuang/frontend/scripts/verify-pages.mjs
T
HHY 6ccd36dc3d feat: 成本核算模块(鲁铭成本核算Excel全量适配, 价格库580条+75/85/95三系列模板+估算器基准精确还原)
- 解析12表成本核算工作簿: 价格库8表→产品价格本(华健型材模具/丝吉利娅/索宾柯五金/隔热条/胶条/赛遨辅材/螺丝/其他)
- 「铝成本」页→系列成本模板(75框扇齐平1.4/85框扇齐平1.8/95窗纱一体1.8, 八分区JSON)
- 估算器口径对齐核算表: 固定/开启/总面积归因缩放+人工每平实际口径+毛利阶梯10%~70%
- 75系列基准估算total=1118.20与核算表成本合计完全一致(85/95同)
- API /api/costbook: import-excel/series/estimate; 前端 /cost_estimate 页
- 种子 seed_costbook.py; 修复6处解析缺陷; 冒烟60/60+24页巡检0异常+深度审计16/16
2026-10-05 05:59:08 -07:00

55 lines
2.1 KiB
JavaScript

// 全页面巡检: 逐页打开收集 JS 异常 + 关键页截图
// 用法: node verify-pages.mjs <token>
import puppeteer from 'puppeteer-core'
const browser = await puppeteer.launch({
executablePath: 'C:/Program Files (x86)/Microsoft/Edge/Application/msedge.exe',
headless: 'new',
args: ['--window-size=1440,900', '--enable-unsafe-swiftshader'],
defaultViewport: { width: 1440, height: 900 },
})
const page = await browser.newPage()
const errors = []
page.on('pageerror', e => errors.push(String(e).slice(0, 150)))
page.on('console', m => { if (m.type() === 'error' && !m.text().includes('favicon')) errors.push('[console] ' + m.text().slice(0, 120)) })
const token = process.argv[2]
const PAGES = [
['dashboard', '/dashboard'],
['orders', '/orders'],
['quotations', '/quotations'],
['contracts', '/contracts'],
['financial', '/financial'],
['customers', '/customers'],
['aftersale', '/aftersale'],
['templates', '/templates'],
['combine', '/combine'],
['rendering', '/rendering'],
['ai_render', '/ai_render'],
['threed', '/threed'],
['measure', '/measure'],
['optimize', '/optimize'],
['cut_solution', '/cut_solution'],
['workshop', '/workshop'],
['printer', '/printer'],
['warehouse', '/warehouse'],
['products', '/products'],
['cost_estimate', '/cost_estimate'],
['devices', '/devices'],
['market', '/market'],
['chart', '/chart'],
['personal', '/personal'],
]
for (const [name, path] of PAGES) {
const before = errors.length
await page.goto(`http://localhost:8000${path}?token=${encodeURIComponent(token)}`, { waitUntil: 'networkidle2' })
await new Promise(r => setTimeout(r, 900))
const add = errors.length - before
console.log(`${add ? '✗' : '✓'} ${name}${add ? ` (${add} 个异常)` : ''}`)
if (['financial', 'workshop', 'templates', 'cut_solution', 'report', 'chart'].includes(name)) {
await page.screenshot({ path: `D:/Code/huamenchuang/shots/patrol-${name}.png` })
}
}
console.log(`\n==== 巡检完成: ${PAGES.length - (errors.length ? 1 : 0)} 页正常, 共 ${errors.length} 条异常 ====`)
errors.slice(0, 8).forEach(e => console.log(' ', e))
await browser.close()