完善合同气瓶绑定引导

This commit is contained in:
czl231
2026-08-14 20:10:09 +08:00
parent 14263416e0
commit 2cff8fb942
7 changed files with 82 additions and 7 deletions

View File

@@ -1,6 +1,6 @@
/**
* 功能:检查配送合同详情页保留可发现的气瓶绑定入口与合同预填参数。
* 版本v1.0.0
* 版本v1.1.0
*/
import assert from 'node:assert/strict';
import { readFileSync } from 'node:fs';
@@ -17,6 +17,10 @@ const resourcesSource = readFileSync(
new URL('../src/api/resources.ts', import.meta.url),
'utf8',
);
const formSource = readFileSync(
new URL('../src/views/resource/ResourceFieldForm.vue', import.meta.url),
'utf8',
);
assert.match(listSource, /definition\.name === 'gasorder_contract' && Number\(record\.contract_status\) === 0/, '绑定入口必须仅展示在草稿合同列表行');
assert.match(listSource, />\s*绑定气瓶\s*</, '草稿合同操作列必须展示“绑定气瓶”按钮');
@@ -27,5 +31,9 @@ assert.match(listSource, /return_to: route\.fullPath/, '绑定完成后必须支
assert.doesNotMatch(detailSource, />\s*绑定气瓶\s*</, '合同详情页不应继续展示绑定按钮');
assert.match(detailSource, /definition\.value\.name === 'gasorder_contract_product'[\s\S]*field\.key === 'gasorder_contract_identity'[\s\S]*route\.query\.relation_key === 'gasorder_contract_identity'[\s\S]*Boolean\(route\.query\.owner_identity\)/, '从合同列表进入时必须锁定预填合同');
assert.match(resourcesSource, /readonlyRelationText: true, displayRelationLabel: true/, '锁定合同必须以可读名称展示');
assert.match(resourcesSource, /label: '智能气阀'/, '绑定表单不得继续显示“智能气阀唯一标识”');
assert.match(resourcesSource, /该合同用户暂无可绑定的智能气阀/, '空候选必须说明合同用户归属前置条件');
assert.match(resourcesSource, /routeName: 'product-info'/, '空候选必须提供智能气阀管理入口');
assert.match(formSource, /navigateRelationEmptyAction/, '关系空状态必须渲染可执行的站内引导');
console.log('合同气瓶绑定入口检查通过:草稿合同列表行可见,进入后锁定所选合同。');
console.log('合同气瓶绑定入口检查通过:草稿合同可绑定气阀,空候选会解释归属条件并跳转智能气阀管理。');