feat: 全系统窗体升级 - 配置驱动通用单据页(BillPage)、原料专用单据页、宽屏弹窗及日期转换优化

This commit is contained in:
2026-08-16 03:58:22 +08:00
parent 1bec470647
commit 9f416561d6
33 changed files with 3379 additions and 96 deletions
+46
View File
@@ -0,0 +1,46 @@
// 验证修复后 iframe 尺寸非 0,且打印内容完整
import { createRequire } from 'module'
import fs from 'fs'
const PW = 'C:/Users/范先生/AppData/Roaming/npm/node_modules/@playwright/cli/node_modules/playwright-core'
const require = createRequire(PW + '/package.json')
const { chromium } = require(PW)
const B = 'http://localhost:5136'
const token = fs.readFileSync(new URL('_token.txt', import.meta.url), 'utf8').trim()
const url = `http://localhost:5227/?print=1&template=2&table=RawMaterial_OutStock&row=2&token=${encodeURIComponent(token)}&api=${B}`
const browser = await chromium.launch({ headless: true, channel: 'msedge' })
const page = await browser.newPage()
page.on('pageerror', (e) => console.log('[pageerror]', e.message))
page.on('console', (m) => { if (m.type() === 'error') console.log('[console]', m.text()) })
await page.goto(url, { waitUntil: 'networkidle', timeout: 30000 })
for (let i = 0; i < 40; i++) {
const ok = await page.evaluate(() => {
const f = document.querySelector('iframe')
return !!(f && f.srcdoc && f.srcdoc.length > 1000)
})
if (ok) break
await new Promise((r) => setTimeout(r, 500))
}
const info = await page.evaluate(() => {
const f = document.querySelector('iframe')
if (!f) return { hasIframe: false }
const rect = f.getBoundingClientRect()
const d = f.contentDocument
return {
hasIframe: true,
iframeCss: f.style.cssText,
rectW: rect.width,
rectH: rect.height,
srcdocLen: f.srcdoc.length,
pages: d ? d.querySelectorAll('.op-page').length : -1,
bodyText: d ? (d.body.textContent || '').replace(/\s+/g, ' ').slice(0, 200) : '',
body: d ? d.body.innerHTML.slice(0, 300) : '',
}
})
console.log(JSON.stringify(info, null, 1))
await browser.close()
console.log('DONE')