完善合同气瓶绑定约束与候选过滤

- 明确合同状态、气瓶归属、停用、报废和重复绑定失败原因
- 根据当前合同过滤可绑定气瓶,排除无效及重复候选项
- 从合同列表进入绑定页时锁定预填合同,防止切换上下文
- 切换通用新建页合同后清空旧气瓶并重新加载候选项
- 增加前后端回归检查并同步中文操作日志
This commit is contained in:
czl231
2026-08-13 00:10:42 +08:00
parent 96d37d63cf
commit 9937e3a508
11 changed files with 120 additions and 10 deletions

View File

@@ -13,6 +13,10 @@ const detailSource = readFileSync(
new URL('../src/views/resource/ResourceRecordPage.vue', import.meta.url),
'utf8',
);
const resourcesSource = readFileSync(
new URL('../src/api/resources.ts', import.meta.url),
'utf8',
);
assert.match(listSource, /definition\.name === 'gasorder_contract' && Number\(record\.contract_status\) === 0/, '绑定入口必须仅展示在草稿合同列表行');
assert.match(listSource, />\s*绑定气瓶\s*</, '草稿合同操作列必须展示“绑定气瓶”按钮');
@@ -21,5 +25,7 @@ assert.match(listSource, /relation_key: 'gasorder_contract_identity'/, '绑定
assert.match(listSource, /owner_identity: String\(row\.identity \?\? ''\)/, '绑定入口必须预填所选合同唯一标识');
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/, '锁定合同必须以可读名称展示');
console.log('合同气瓶绑定入口检查通过:仅草稿合同列表行可见,已启用合同和详情页均隐藏。');
console.log('合同气瓶绑定入口检查通过:仅草稿合同列表行可见,进入后锁定所选合同。');