Files
ERP/ofbiz-framework/plugins/modern-ui/app/scripts/verify-business-page-console.mjs
QiufengandClaude Opus 4.8 5e51dc3f56 SNAPSHOT W7 已部署稳定态 — 凯迪ERP+OA一体化平台 (MET 73.3%)
恢复点(restore point)。别人改崩后可 git reset --hard 回到此提交。

== 此快照内容 ==
- 后端 oa-backend: 734 控制器 / 711 实体 (Spring Boot 3.2.5 + SQLite, 端口8091)
- 前端 modern-ui/app: Vue3+Vite, 约700页 (构建产物已在 oa-backend/src/main/resources/static)
- 数据库 oa-backend/data/oa.db: 含全部演示数据 (强制入库, 6.6MB)
- 交接文档 go.md + go-code-reference/endpoints/entities/database.md
- 多代理建设脚本 .claude/wf-*.js

== 状态 ==
- 对 凯迪科技ERP_20260507.xlsx 合规 MET ~73.3% (PARTIAL 75: 34可建+6种子/bug+35外部硬天花板)
- 安全: 5轮红队+5轮复检, default-deny分级鉴权, 连续零可利用
- W3~W7 累计补完436缺口; W8末轮(40缺口)为半成品(源码树可编译但未集成)
- 运行: cd oa-backend; java -jar build/libs/oa-backend-0.1.0.jar --server.port=8091; admin/123456

== 排除(gitignore, 可再生) ==
node_modules / oa-backend/build / .jdks / *.log / Backup-ERP-* / 弃用的OFBiz核心(只保留modern-ui)
完整文件夹备份见同目录 Backup-ERP-20260615-191517/ (含上述全部, 仅缺 node_modules)

时间戳: 20260615-191517

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-15 19:19:15 +08:00

180 lines
7.7 KiB
JavaScript

#!/usr/bin/env node
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
import assert from 'node:assert/strict'
import { readFile } from 'node:fs/promises'
import path from 'node:path'
import { fileURLToPath } from 'node:url'
const scriptPath = fileURLToPath(import.meta.url)
const appRoot = path.resolve(path.dirname(scriptPath), '..')
const pageVue = await readFile(path.join(appRoot, 'src/views/BusinessPageView.vue'), 'utf8')
const tabbedDataPanelVue = await readFile(path.join(appRoot, 'src/components/erp/ErpTabbedDataPanel.vue'), 'utf8')
const rendererVue = await readFile(path.join(appRoot, 'src/components/erp/ErpPageRenderer.vue'), 'utf8')
const adapterVue = await readFile(path.join(appRoot, 'src/components/erp/ErpAdapterBlock.vue'), 'utf8')
const displayTs = await readFile(path.join(appRoot, 'src/utils/display.ts'), 'utf8')
const modernCss = await readFile(path.join(appRoot, 'src/styles/modern.css'), 'utf8')
for (const text of [
"activeTab = ref('overview')",
'const businessDataTabs = computed(() => [',
"{ id: 'overview', label: '处理台' }",
"{ id: 'records', label: '资料明细' }",
"{ id: 'actions', label: '处理动作' }",
"{ id: 'flow', label: '操作记录' }",
'<ErpTabbedDataPanel',
':tabs="businessDataTabs"',
'data-modern="business-page-tabbed-data"',
'data-modern-tab-panel="overview"',
'data-modern-tab-panel="records"',
'data-modern-tab-panel="actions"',
'data-modern-tab-panel="flow"',
"setActiveTab('records')",
"setActiveTab('actions')",
'businessDocumentRows',
'businessActionRows',
'businessFlowRows',
'businessRecordRows',
'businessCapabilityRows',
'businessContextRows',
'routePayloadRows',
'handoffRows',
'处理概况',
'处理步骤',
'后续处理',
'交接条件',
'办理资料',
'资料类型',
'明细列表',
'处理工具',
'可执行动作',
'business-page-console',
'business-page-workbench'
]) {
assert.ok(pageVue.includes(text), `business page must present an ERP document surface: ${text}`)
}
assert.doesNotMatch(
pageVue,
/<el-tabs|<el-tab-pane/,
'business pages must use ErpTabbedDataPanel instead of direct Element Plus tabs'
)
for (const text of [
'data-modern="erp-tabbed-data-panel"',
'v-for="tab in tabs"',
':name="tab.id"',
'{{ tab.label }}'
]) {
assert.ok(tabbedDataPanelVue.includes(text), `tabbed data wrapper must render data-driven business tabs: ${text}`)
}
for (const text of [
'处理台',
'资料明细',
'处理动作',
'操作记录',
'当前上下文'
]) {
assert.match(pageVue + rendererVue + modernCss, new RegExp(text), `business pages should read like an administrator ERP site: ${text}`)
}
assert.doesNotMatch(
pageVue,
/label="工作面"|label="数据区"|label="执行区"|label="审批流"|<el-tab-pane label="业务概览" name="overview"|<el-tab-pane label="数据与查询" name="data"|<el-tab-pane label="规则与权限" name="rules"|<el-tab-pane label="业务流程" name="workflow"|<el-tab-pane label="系统定义" name="definition"/,
'primary business tabs must not read like page-definition, engineering, or old console surfaces'
)
assert.doesNotMatch(
pageVue,
/页面数据面|控件能力|页面定义 JSON|接口定义|流程编号|后端服务协同|Service Dispatcher|统一 Lookup|业务工作面|页面结构|动作编码|元数据|适配器/,
'technical traceability copy should not appear in the primary business page chrome'
)
assert.doesNotMatch(
pageVue,
/前端已重写|适配器已覆盖|页面结构">已生成|界面规则|待输出比对|待验收|系统记录|页面配置|CodePreview|JSON\.stringify|{{\s*[^}]*pending-business-e2e[^}]*}}|待确认|规则与权限/,
'business page should use operational language instead of migration or acceptance wording'
)
assert.doesNotMatch(
pageVue,
/prop="method" label="Method"|prop="path" label="Path"|apiContracts|endpointRows/,
'ordinary ERP business pages must not expose API contract tables'
)
for (const text of ['处理台', '业务流转', '当前上下文', '业务记录', '业务参数已带入当前单据', '处理状态', '处理方式', '适用范围']) {
assert.match(pageVue + rendererVue, new RegExp(text), `business copy should orient users around operation: ${text}`)
}
assert.doesNotMatch(
pageVue,
/业务审计|审计轨迹|已留痕/,
'generated business pages must not present synthesized front-end context as real audit records'
)
assert.doesNotMatch(
pageVue,
/原 OFBiz 动作|旧 URL 参数|旧 GET|旧入口兼容|业务回归|功能等价|待业务回归|控制规则|页面规则|来源入口|来源参数/,
'operator-facing business pages must avoid migration, compatibility, and parity wording'
)
assert.match(rendererVue, /'client-behavior': '表单联动'/, 'technical client-behavior blocks should render with a business-facing label')
assert.match(rendererVue, /if \(block\.type === 'client-behavior'\) return '表单联动'/, 'renderer block titles should normalize client behavior blocks')
assert.match(adapterVue, /function blockHeading\(\)/, 'adapter blocks should normalize technical block titles')
assert.match(adapterVue, /kind\.value === 'client-behavior'\) return '表单联动'/, 'client behavior adapter blocks should not expose old technical titles')
assert.doesNotMatch(
pageVue + rendererVue + adapterVue,
/>\s*client-behavior\s*</,
'operator-facing business chrome must not expose generated client-behavior labels'
)
assert.match(pageVue, /function businessStepLabel\(/, 'business timeline should translate migration steps into operational steps')
assert.match(displayTs, /'order find order': '订单查询'/, 'common OFBiz order finder titles should render as Chinese product copy')
assert.match(displayTs, /function userFacingLabel\(/, 'shared display utilities should normalize user-visible generated labels')
assert.match(displayTs, /function userFacingText\(/, 'shared display utilities should normalize user-visible generated descriptions')
assert.match(displayTs, /forbiddenTechnicalText/, 'shared display utilities should centralize forbidden technical wording')
assert.match(displayTs, /replaceForbiddenTechnicalText/, 'shared display utilities should replace forbidden generated-page wording before rendering')
for (const [source, sourceName] of [
[pageVue, 'BusinessPageView.vue'],
[rendererVue, 'ErpPageRenderer.vue'],
[adapterVue, 'ErpAdapterBlock.vue']
]) {
assert.match(source, /userFacingLabel|userFacingText/, `${sourceName} must pass generated visible strings through business-language normalization`)
}
for (const selector of [
'business-page-console',
'business-page-workbench',
'business-page-side-panel',
'business-document-summary',
'business-timeline-list',
'business-page-queue-grid',
'business-page-action-card',
'business-page-handoff-row'
]) {
assert.match(modernCss, new RegExp(selector), `business page CSS should style console layout: ${selector}`)
}
console.log(JSON.stringify({
status: 'passed',
checked: ['BusinessPageView.vue', 'ErpPageRenderer.vue', 'modern.css']
}, null, 2))