From 8a8db5088303016d69d42630f0e3d2b937065d6b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E9=B9=8F?= Date: Thu, 18 Jun 2026 11:24:45 +0800 Subject: [PATCH] Document auto-increment form visibility --- ...6-18-hide-auto-increment-id-form-design.md | 57 +++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 RuoYi-Vue/docs/superpowers/specs/2026-06-18-hide-auto-increment-id-form-design.md diff --git a/RuoYi-Vue/docs/superpowers/specs/2026-06-18-hide-auto-increment-id-form-design.md b/RuoYi-Vue/docs/superpowers/specs/2026-06-18-hide-auto-increment-id-form-design.md new file mode 100644 index 0000000..61d799e --- /dev/null +++ b/RuoYi-Vue/docs/superpowers/specs/2026-06-18-hide-auto-increment-id-form-design.md @@ -0,0 +1,57 @@ +# Hide Auto-Increment IDs in Create Forms + +## Goal + +Generated Qing management pages must not ask users to enter an auto-increment primary key when creating a record. + +## Chosen behavior + +- Create mode: hide every column whose `isIncrement` value is `"1"`. +- Edit mode: show the auto-increment primary key as read-only. +- View mode: show the auto-increment primary key as read-only. +- List and detail displays remain unchanged. +- Non-auto-increment primary keys keep their existing form behavior. + +This preserves record identity during editing and viewing while removing an invalid input from creation. + +## Considered approaches + +1. Hide auto-increment IDs only in create mode. This is the selected approach because it fixes the usability problem without removing useful record identity from edit and view dialogs. +2. Hide auto-increment IDs in every form mode. This is simpler but makes edit and view dialogs less informative. +3. Remove auto-increment columns from generated form metadata. This would also remove them from edit and view modes and would make page-designer overrides harder to honor. + +## Template behavior + +The Qing Vue template will decide field visibility at runtime: + +- A form field still needs to qualify under the existing designed/default form rules. +- If the field is auto-increment and the dialog is in create mode, it is not rendered. +- If the field is auto-increment and the dialog is in edit or view mode, it is rendered with a disabled input. +- Required-field validation must not be attached to an auto-increment field. + +The existing `form.` value distinguishes create mode from edit/view mode. + +## Scope + +The change applies to generated Qing frontend and admin-frontend CRUD pages that use `qing/index.vue.vm`. + +It does not change: + +- database schemas; +- entity or controller generation; +- insert/update payload handling; +- list columns; +- detail pages; +- manually authored applications. + +## Tests + +Template rendering tests will verify: + +- an auto-increment primary key is conditionally hidden in create mode; +- the same field is present and disabled in edit/view mode; +- it has no required validation rule; +- a non-auto-increment primary key keeps its existing behavior; +- ordinary editable fields continue to render normally. + +After template tests pass, regenerate or patch the current project 106 preview and verify the book create dialog no longer shows the ID field.