2026-08-12 22:46:55 +08:00
|
|
|
|
/**
|
|
|
|
|
|
* 功能:检查配送合同详情页保留可发现的气瓶绑定入口与合同预填参数。
|
|
|
|
|
|
* 版本:v1.0.0
|
|
|
|
|
|
*/
|
|
|
|
|
|
import assert from 'node:assert/strict';
|
|
|
|
|
|
import { readFileSync } from 'node:fs';
|
|
|
|
|
|
|
|
|
|
|
|
const listSource = readFileSync(
|
|
|
|
|
|
new URL('../src/views/shared/CrudListPage.vue', import.meta.url),
|
|
|
|
|
|
'utf8',
|
|
|
|
|
|
);
|
|
|
|
|
|
const detailSource = readFileSync(
|
|
|
|
|
|
new URL('../src/views/resource/ResourceRecordPage.vue', import.meta.url),
|
|
|
|
|
|
'utf8',
|
|
|
|
|
|
);
|
2026-08-13 00:10:42 +08:00
|
|
|
|
const resourcesSource = readFileSync(
|
|
|
|
|
|
new URL('../src/api/resources.ts', import.meta.url),
|
|
|
|
|
|
'utf8',
|
|
|
|
|
|
);
|
2026-08-12 22:46:55 +08:00
|
|
|
|
|
|
|
|
|
|
assert.match(listSource, /definition\.name === 'gasorder_contract' && Number\(record\.contract_status\) === 0/, '绑定入口必须仅展示在草稿合同列表行');
|
|
|
|
|
|
assert.match(listSource, />\s*绑定气瓶\s*</, '草稿合同操作列必须展示“绑定气瓶”按钮');
|
|
|
|
|
|
assert.match(listSource, /name: 'user-contract-products-create'/, '绑定入口必须跳转合同气瓶新建页');
|
|
|
|
|
|
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*</, '合同详情页不应继续展示绑定按钮');
|
2026-08-13 00:10:42 +08:00
|
|
|
|
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/, '锁定合同必须以可读名称展示');
|
2026-08-12 22:46:55 +08:00
|
|
|
|
|
2026-08-13 00:10:42 +08:00
|
|
|
|
console.log('合同气瓶绑定入口检查通过:仅草稿合同列表行可见,进入后锁定所选合同。');
|