cmvr-wms/scripts/projectdev/vue3-cell-overflow-check.cjs
lixiaolong 5bdeceafd7 feat(auth): 添加认证cookie名称配置并优化表单布局
- 在 .env.production 中新增 VITE_AUTH_COOKIE_NAME 配置项用于设置认证cookie名称
- 将 AcceptanceException.vue 中的表单标签宽度从固定90px改为自动适配
- 在 ActionDialog.vue 中将多个表单项标记为必填项并调整标签宽度为自动适配
- 重构 ActionHistory.vue 中的按钮布局结构并添加表格列样式类名
- 更新 api-contract-audit.cjs 添加生产任务和BOM相关接口的契约测试
- 修改 auth.js 使用动态认证cookie键名替换硬编码的Admin-Token
- 调整系统角色授权用户页面的表单布局和表格样式类名
- 优化 ReceiptDialog Batch 组件的对话框尺寸、表单验证和分页功能
2026-10-15 11:30:55 +08:00

13 lines
1.6 KiB
JavaScript

const assert=require('node:assert/strict')
// Inspect actual rendered controls, not just columns named "状态" or "操作".
module.exports=async function checkControlCells(page,label='page'){
const cells=await page.locator('.el-table td .cell').evaluateAll(nodes=>nodes.filter(el=>el.getClientRects().length&&el.querySelector('.el-button,.el-dropdown,.el-tag,.el-progress,.el-input,.el-input-number,.el-select,.el-checkbox,.el-radio,.el-switch')).map(el=>{
const b=el.getBoundingClientRect(),visible=x=>x.getClientRects().length&&getComputedStyle(x).visibility!=='hidden'
return {text:el.textContent.trim().slice(0,100),overflow:getComputedStyle(el).textOverflow,clippedControls:[...el.querySelectorAll('.el-button,.el-tag,.el-input-number,.el-checkbox,.el-switch')].filter(visible).filter(x=>{const r=x.getBoundingClientRect();return r.width>b.width+2}).map(x=>({text:x.textContent.trim(),width:x.getBoundingClientRect().width,cellWidth:b.width}))}
}))
for(const cell of cells){assert.notEqual(cell.overflow,'ellipsis',label+' control cell ellipsis '+JSON.stringify(cell));assert.deepEqual(cell.clippedControls,[],label+' oversized control '+JSON.stringify(cell))}
const headers=await page.locator('.el-table th.business-status-cell .cell,.el-table th.business-operation-cell .cell,.el-table th.business-control-cell .cell').evaluateAll(nodes=>nodes.filter(el=>el.getClientRects().length).map(el=>({text:el.textContent.trim(),overflow:getComputedStyle(el).textOverflow})))
for(const header of headers)assert.notEqual(header.overflow,'ellipsis',label+' control header ellipsis '+header.text)
return {controlCells:cells.length,controlHeaders:headers.length}
}