优化合同气瓶绑定与启用失败提示

- 将绑定气瓶入口移至合同列表,仅草稿合同显示
- 自动预填所选合同并保留返回路径
- 细分附件、有效期、气瓶绑定和状态校验失败原因
- 增加前后端回归检查及中文操作日志
This commit is contained in:
czl231
2026-08-12 22:46:55 +08:00
parent 8ad6748397
commit 96d37d63cf
7 changed files with 202 additions and 7 deletions

View File

@@ -17,6 +17,7 @@
"account-roles:check": "node scripts/check-account-role-presentation.mjs",
"avatar-retry:check": "node scripts/check-avatar-upload-cache.mjs",
"contract-attachment:check": "node scripts/check-contract-attachment-control.mjs",
"contract-product-entry:check": "node scripts/check-contract-product-entry.mjs",
"staff-organization:check": "node scripts/check-staff-organization-linkage.mjs",
"staff-relations:check": "node scripts/check-staff-relation-policy.mjs",
"user-address-display:check": "node scripts/check-user-address-relation-display.mjs",

View File

@@ -0,0 +1,25 @@
/**
* 功能:检查配送合同详情页保留可发现的气瓶绑定入口与合同预填参数。
* 版本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',
);
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*</, '合同详情页不应继续展示绑定按钮');
console.log('合同气瓶绑定入口检查通过:仅草稿合同列表行可见,已启用合同和详情页均隐藏。');

View File

@@ -107,6 +107,12 @@
<a-button v-if="definition.accountManagement" size="mini" type="primary" @click="manageAccounts(record)">账户管理</a-button>
<a-button v-if="definition.name === 'staff_account'" size="mini" @click="viewCredentials(record)">查看资质</a-button>
<a-button size="mini" @click="openRecord('detail', record)">详情</a-button>
<a-button
v-if="definition.name === 'gasorder_contract' && Number(record.contract_status) === 0"
size="mini"
type="primary"
@click="bindContractProduct(record)"
>绑定气瓶</a-button>
<a-tooltip v-if="canEdit" :content="recordEditReason(record) || '编辑记录'">
<a-button size="mini" :disabled="Boolean(recordEditReason(record))" @click="openRecord('edit', record)">编辑</a-button>
</a-tooltip>
@@ -370,6 +376,18 @@ function viewCredentials(row: ResourceRow) {
});
}
/** 从草稿合同列表进入合同气瓶新建页,并预填所选合同。 */
function bindContractProduct(row: ResourceRow) {
return router.push({
name: 'user-contract-products-create',
query: {
relation_key: 'gasorder_contract_identity',
owner_identity: String(row.identity ?? ''),
return_to: route.fullPath,
},
});
}
function returnManagedList() {
const target = safeReturnPath(route.query.return_to);
return router.push(target || { name: String(route.meta.activeMenu ?? '') });