From 2cff8fb942095510c6db26d729e79fcc534ad9cd Mon Sep 17 00:00:00 2001 From: czl231 <3286836406@qq.com> Date: Fri, 14 Aug 2026 20:10:09 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E5=96=84=E5=90=88=E5=90=8C=E6=B0=94?= =?UTF-8?q?=E7=93=B6=E7=BB=91=E5=AE=9A=E5=BC=95=E5=AF=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gasorder/contract_change_error_test.go | 2 +- .../logic/platform/gasorder/gasorder.go | 2 +- docs/05-平台总后台需求.md | 2 +- docs/操作日志_合同气瓶空状态引导_20260814.md | 35 +++++++++++++++++++ .../scripts/check-contract-product-entry.mjs | 12 +++++-- frontend/platform_admin/src/api/resources.ts | 5 +++ .../src/views/resource/ResourceFieldForm.vue | 31 ++++++++++++++-- 7 files changed, 82 insertions(+), 7 deletions(-) create mode 100644 docs/操作日志_合同气瓶空状态引导_20260814.md diff --git a/backend/api/internal/logic/platform/gasorder/contract_change_error_test.go b/backend/api/internal/logic/platform/gasorder/contract_change_error_test.go index 20a35bd..2740031 100644 --- a/backend/api/internal/logic/platform/gasorder/contract_change_error_test.go +++ b/backend/api/internal/logic/platform/gasorder/contract_change_error_test.go @@ -49,7 +49,7 @@ func TestContractActivationErrorMessages(t *testing.T) { errContractAttachment: "合同附件无效,请重新上传有效的 PDF 文件后再启用", errContractNotEffective: "合同尚未到生效时间,暂时不能启用", errContractExpired: "合同已到期,请调整到期时间或续签后再启用", - errContractNoProduct: "合同尚未绑定有效气瓶,请先绑定气瓶后再启用", + errContractNoProduct: "合同尚未绑定有效智能气阀。请先点击“绑定气阀”;若无可选设备,请到“智能气阀管理”将设备归属变更为合同用户,并确认设备已启用、未报废", } for businessErr, message := range want { if businessErr.Error() != message { diff --git a/backend/api/internal/logic/platform/gasorder/gasorder.go b/backend/api/internal/logic/platform/gasorder/gasorder.go index d890ffe..05062d9 100644 --- a/backend/api/internal/logic/platform/gasorder/gasorder.go +++ b/backend/api/internal/logic/platform/gasorder/gasorder.go @@ -28,7 +28,7 @@ var ( errContractAttachment = errors.New("合同附件无效,请重新上传有效的 PDF 文件后再启用") errContractNotEffective = errors.New("合同尚未到生效时间,暂时不能启用") errContractExpired = errors.New("合同已到期,请调整到期时间或续签后再启用") - errContractNoProduct = errors.New("合同尚未绑定有效气瓶,请先绑定气瓶后再启用") + errContractNoProduct = errors.New("合同尚未绑定有效智能气阀。请先点击“绑定气阀”;若无可选设备,请到“智能气阀管理”将设备归属变更为合同用户,并确认设备已启用、未报废") errBindingContractStatus = errors.New("仅草稿合同可以绑定气瓶") errBindingProductDisabled = errors.New("所选气瓶已停用,不能绑定到合同") errBindingProductScrapped = errors.New("所选气瓶已报废,不能绑定到合同") diff --git a/docs/05-平台总后台需求.md b/docs/05-平台总后台需求.md index 64e3d9f..4e0472c 100644 --- a/docs/05-平台总后台需求.md +++ b/docs/05-平台总后台需求.md @@ -185,7 +185,7 @@ 合同气瓶必须属于合同用户、处于可用状态且未报废;订单只能使用有效合同中仍绑定的气瓶。 -合同气瓶绑定页面只允许选择草稿合同;已生效、已过期或已终止合同不进入绑定候选。合同管理列表仍展示全部生命周期状态。 +合同气瓶绑定页面只允许选择草稿合同;已生效、已过期或已终止合同不进入绑定候选。绑定字段使用“智能气阀”业务名称。合同用户没有符合条件的智能气阀时,页面必须说明设备需先归属合同用户、处于启用且未报废状态,并提供前往“智能气阀管理”的站内入口。合同管理列表仍展示全部生命周期状态。 ### 6.6 气体配送订单 diff --git a/docs/操作日志_合同气瓶空状态引导_20260814.md b/docs/操作日志_合同气瓶空状态引导_20260814.md new file mode 100644 index 0000000..4be16a5 --- /dev/null +++ b/docs/操作日志_合同气瓶空状态引导_20260814.md @@ -0,0 +1,35 @@ +# 操作日志:合同气瓶空状态引导 + +操作时间:2026-08-14 + +操作类型:修改、扩展 + +影响模块:平台总后台、配送合同、合同气瓶 + +## 操作前状态 + +草稿合同没有可绑定设备时,智能气阀下拉仅显示“暂无数据”。管理员无法得知设备必须先归属合同用户并处于启用、未报废状态;启用合同失败提示也没有完整说明处理顺序。 + +## 具体操作 + +- 将合同气瓶绑定表单字段标题从“智能气阀唯一标识”改为“智能气阀”。 +- 空候选明确提示设备归属、启用状态和报废状态要求。 +- 增加“前往智能气阀管理”站内入口。 +- 启用合同失败时提示先绑定智能气阀;无候选时引导先变更设备归属。 +- 保留服务端“设备必须属于合同用户”的最终校验,不允许跨用户绑定。 + +## 操作后状态 + +管理员可以从空状态直接进入智能气阀管理,完成“变更智能气阀归属”,返回合同列表绑定设备后再启用合同。 + +## 代码变更 + +- `backend/api/internal/logic/platform/gasorder/gasorder.go`:完善合同无有效智能气阀时的业务提示。 +- `backend/api/internal/logic/platform/gasorder/contract_change_error_test.go`:固定中文错误信息。 +- `frontend/platform_admin/src/api/resources.ts`:配置业务字段名、空状态说明和跳转入口。 +- `frontend/platform_admin/src/views/resource/ResourceFieldForm.vue`:支持关系空状态站内操作按钮。 +- `frontend/platform_admin/scripts/check-contract-product-entry.mjs`:增加字段名、说明和入口回归检查。 + +## 验证与风险 + +本次不修改数据库结构和数据,不放宽候选筛选及绑定校验。新增空状态操作为通用可选配置,未配置的其他关系字段保持原有行为。 diff --git a/frontend/platform_admin/scripts/check-contract-product-entry.mjs b/frontend/platform_admin/scripts/check-contract-product-entry.mjs index 2968149..0ea82c9 100644 --- a/frontend/platform_admin/scripts/check-contract-product-entry.mjs +++ b/frontend/platform_admin/scripts/check-contract-product-entry.mjs @@ -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*\s*绑定气瓶\s*; /** 筛选结果中不存在当前值时立即清空,禁止通过详情补载绕过候选范围。 */ @@ -541,7 +543,10 @@ export const resources: ResourceUiDefinition[] = [ relationInvalidMessage: '所选合同已不是草稿状态,已清空,请重新选择', relationEmptyText: '暂无可绑定气瓶的草稿合同,请先新建配送合同', }), relation('product_info_identity', '/product_info', true, { + label: '智能气阀', placeholder: '请先选择合同,再选择该合同用户可绑定的气瓶', + relationEmptyText: '该合同用户暂无可绑定的智能气阀。请先到“智能气阀管理”将设备归属变更为该用户,并确认设备已启用、未报废。', + relationEmptyAction: { label: '前往智能气阀管理', routeName: 'product-info' }, relationLinkage: { parentKey: 'gasorder_contract_identity', optionParentKey: '', filterKey: 'contract_identity', filterOnly: true, diff --git a/frontend/platform_admin/src/views/resource/ResourceFieldForm.vue b/frontend/platform_admin/src/views/resource/ResourceFieldForm.vue index 5889fb0..f0775d7 100644 --- a/frontend/platform_admin/src/views/resource/ResourceFieldForm.vue +++ b/frontend/platform_admin/src/views/resource/ResourceFieldForm.vue @@ -1,6 +1,6 @@