docs: add dialog label-top spacing unify spec and plan
Scope B for all label-top dialogs; keep compact 11px stock-check labels as exception. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
3edfb9dd86
commit
32c742c1ed
2 files changed
+385
No files matched your search
@@ -0,0 +1,261 @@
|
||||
# 弹窗 label-top 间距与字重统一 Implementation Plan
|
||||
|
||||
> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking.
|
||||
|
||||
**Goal:** 全站 `label-position="top"` 弹窗统一为 label–控件 4px、字重 400、栅格内无叠加 margin;保留物资盘点紧凑 11px label;文档与代码一致。
|
||||
|
||||
**Architecture:** 以全局 SCSS(`el-ui.scss` + `app.scss`)为唯一权威;扩展 `.form-grid` 与 dialog 兜底;Phase 2 仅删除/收敛会冲突的 scoped,不逐页重写样式。盘点紧凑 label 作为刻意例外不改。
|
||||
|
||||
**Tech Stack:** Vue 3 + Element Plus;全局 SCSS;Fresh Mint UI 规范文档。
|
||||
|
||||
**Spec:** `docs/superpowers/specs/2026-10-10-dialog-label-top-spacing-unify-design.md`
|
||||
|
||||
---
|
||||
|
||||
## File map
|
||||
|
||||
| File | Responsibility |
|
||||
|------|----------------|
|
||||
| `web-admin/src/assets/styles/core/el-ui.scss` | label-top:4px / 400 / height auto(已基本完成,Task 1 复核) |
|
||||
| `web-admin/src/assets/styles/core/app.scss` | `.form-grid` + `form-grid-*` margin 归零;dialog 内无栅格行距兜底 |
|
||||
| 若干业务 `*FormDialog.vue` / 大表单页 | 删除与全局重复的 label/margin 覆盖(不动盘点 11px) |
|
||||
| `docs/web-admin-ui-spec-fresh-mint.md` | 文档对齐 400 / 4px |
|
||||
| `openspec/changes/zkxw-engineering-standards/specs/ui-conventions/spec.md` | 若有冲突 SHALL,同步一句 |
|
||||
|
||||
---
|
||||
|
||||
### Task 1: 复核并锁定全局 label-top 规则
|
||||
|
||||
**Files:**
|
||||
- Modify(必要时): `web-admin/src/assets/styles/core/el-ui.scss`
|
||||
|
||||
- [ ] **Step 1: 确认现有规则**
|
||||
|
||||
打开 `el-ui.scss`,确保存在且仅为:
|
||||
|
||||
```scss
|
||||
.el-form--label-top .el-form-item__label {
|
||||
height: auto !important;
|
||||
line-height: 1.4 !important;
|
||||
font-size: 13px !important;
|
||||
font-weight: 400 !important;
|
||||
color: var(--mint-text) !important;
|
||||
padding: 0 0 4px !important;
|
||||
margin-bottom: 0 !important;
|
||||
}
|
||||
```
|
||||
|
||||
若有偏差,改回上表。勿改通用 `.el-form-item__label` 的 36px(左右布局仍需要)。
|
||||
|
||||
- [ ] **Step 2: Commit(若有改动)**
|
||||
|
||||
```bash
|
||||
git add web-admin/src/assets/styles/core/el-ui.scss
|
||||
git commit -m "$(cat <<'EOF'
|
||||
fix(web-admin): lock label-top dialog label spacing and weight
|
||||
|
||||
Keep 4px gap and font-weight 400 for vertical form labels.
|
||||
EOF
|
||||
)"
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### Task 2: 扩展栅格 margin 归零 + dialog 行距兜底
|
||||
|
||||
**Files:**
|
||||
- Modify: `web-admin/src/assets/styles/core/app.scss`
|
||||
|
||||
- [ ] **Step 1: 扩展选择器**
|
||||
|
||||
将现有:
|
||||
|
||||
```scss
|
||||
.form-grid-2,
|
||||
.form-grid-3,
|
||||
.form-grid-4,
|
||||
.form-grid-5 {
|
||||
> .el-form-item {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
改为同时覆盖自建 `.form-grid`,并覆盖嵌套一层的 form-item(部分页面把 item 包在 fragment/div 内时用后代选择器更稳):
|
||||
|
||||
```scss
|
||||
/* 纵向间距交给 gap,避免与 el-form-item 默认 margin-bottom 叠加 */
|
||||
.form-grid,
|
||||
.form-grid-2,
|
||||
.form-grid-3,
|
||||
.form-grid-4,
|
||||
.form-grid-5 {
|
||||
> .el-form-item,
|
||||
> .el-form-item.el-form-item--label-top {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
说明:若实测自建 `.form-grid` 内 item 不是直接子元素,再改为 `.form-grid .el-form-item { margin-bottom: 0; }`(注意勿误伤 `.form-grid` 外嵌套表单;优先直接子代)。
|
||||
|
||||
- [ ] **Step 2: dialog 无栅格兜底**
|
||||
|
||||
在 `app.scss` 的 `.el-dialog.dialog-form-layout` 段落后追加:
|
||||
|
||||
```scss
|
||||
/* label-top 弹窗:无栅格时也收紧默认 18px 行距 */
|
||||
.el-dialog.dialog-form-layout .el-form--label-top > .el-form-item,
|
||||
.el-dialog.dialog-form-layout .el-form--label-top > .el-row .el-form-item {
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
|
||||
.el-dialog.dialog-form-layout .el-form--label-top .form-grid .el-form-item,
|
||||
.el-dialog.dialog-form-layout .el-form--label-top .form-grid-2 .el-form-item,
|
||||
.el-dialog.dialog-form-layout .el-form--label-top .form-grid-3 .el-form-item,
|
||||
.el-dialog.dialog-form-layout .el-form--label-top .form-grid-4 .el-form-item,
|
||||
.el-dialog.dialog-form-layout .el-form--label-top .form-grid-5 .el-form-item {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
```
|
||||
|
||||
- [ ] **Step 3: 本地目视**
|
||||
|
||||
打开预签约新增弹窗 + 任一未用 `form-grid-*` 的小弹窗(如状态变更类),确认行距正常、label 间距约 4px。
|
||||
|
||||
- [ ] **Step 4: Commit**
|
||||
|
||||
```bash
|
||||
git add web-admin/src/assets/styles/core/app.scss
|
||||
git commit -m "$(cat <<'EOF'
|
||||
fix(web-admin): tighten label-top row spacing for all dialog grids
|
||||
|
||||
Zero form-item margin inside .form-grid* and add dialog fallback spacing.
|
||||
EOF
|
||||
)"
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### Task 3: 清理自建 `.form-grid` 页面的冲突 / 冗余
|
||||
|
||||
**Files(按序处理,有则改、无则跳过):**
|
||||
- `web-admin/src/views/cell-storage/protocol/ProtocolFormDialog.vue`
|
||||
- `web-admin/src/views/research-donation/list/DonationFormDialog.vue`
|
||||
- `web-admin/src/views/pilot-service/pilot-application/ApplicationFormDialog.vue`
|
||||
- `web-admin/src/views/pilot-service/channel/index.vue`
|
||||
- `web-admin/src/views/pilot-service/infusion-schedule-management/ScheduleEditDialog.vue`
|
||||
- `web-admin/src/views/quality-inspection/sample-reception/index.vue`
|
||||
- 其它 `rg '\.form-grid\s*\{' web-admin/src/views` 命中且含 `label-position="top"` 的弹窗
|
||||
|
||||
- [ ] **Step 1: 扫描**
|
||||
|
||||
```bash
|
||||
rg -n "el-form-item__label|margin-bottom:\s*0|font-weight:\s*500" \
|
||||
web-admin/src/views/cell-storage/protocol/ProtocolFormDialog.vue \
|
||||
web-admin/src/views/research-donation/list/DonationFormDialog.vue \
|
||||
web-admin/src/views/pilot-service/pilot-application/ApplicationFormDialog.vue \
|
||||
web-admin/src/views/pilot-service/channel/index.vue \
|
||||
web-admin/src/views/pilot-service/infusion-schedule-management/ScheduleEditDialog.vue \
|
||||
web-admin/src/views/quality-inspection/sample-reception/index.vue
|
||||
```
|
||||
|
||||
- [ ] **Step 2: 清理规则**
|
||||
|
||||
对每个文件:
|
||||
|
||||
1. 若 `.form-grid :deep(.el-form-item) { margin-bottom: 0 }` 已与全局重复 → **可保留**(无害)或删除以减噪。
|
||||
2. 若弹窗 label-top 下写了 `font-weight: 500` 或强制 `height: 36px` → **删除**这些行,依赖全局。
|
||||
3. **不要**改 `gap`(各业务页 `12px 16px` / `16px 20px` 可保留)。
|
||||
4. **不要**改 `protocol-total-inline` 等左 label 特例。
|
||||
5. **不要**改任何盘点/库存卡片里 `font-size: 11px` + `padding-bottom: 2px` 的紧凑 label。
|
||||
|
||||
- [ ] **Step 3: Commit**
|
||||
|
||||
```bash
|
||||
git add web-admin/src/views/cell-storage/protocol/ProtocolFormDialog.vue \
|
||||
web-admin/src/views/research-donation/list/DonationFormDialog.vue \
|
||||
web-admin/src/views/pilot-service/pilot-application/ApplicationFormDialog.vue \
|
||||
web-admin/src/views/pilot-service/channel/index.vue \
|
||||
web-admin/src/views/pilot-service/infusion-schedule-management/ScheduleEditDialog.vue \
|
||||
web-admin/src/views/quality-inspection/sample-reception/index.vue
|
||||
git commit -m "$(cat <<'EOF'
|
||||
refactor(web-admin): drop redundant label-top overrides in large form dialogs
|
||||
|
||||
Rely on global label-top and form-grid margin rules.
|
||||
EOF
|
||||
)"
|
||||
```
|
||||
|
||||
(无文件变更则跳过 commit。)
|
||||
|
||||
---
|
||||
|
||||
### Task 4: 业务域抽检清单
|
||||
|
||||
**Files:** 无代码;手工验收。
|
||||
|
||||
- [ ] **Step 1: 按域打开弹窗**
|
||||
|
||||
| 域 | 路径(hash) | 期望 |
|
||||
|----|----------------|------|
|
||||
| 系统 | `/#/demo/unit` 新增 | 4px / 400 / 行距紧凑 |
|
||||
| 细胞存储 | `/#/market/cell-storage/presign-order` 新增 | 同上(基线) |
|
||||
| 细胞存储 | 协议新增/编辑 | 同上;总金额左 label 例外仍横排 |
|
||||
| 试点 | 申请表单 / 渠道相关弹窗 | 同上 |
|
||||
| 生产或质检 | 任一标准 CRUD 新增 | 同上 |
|
||||
| OA | 收款账户新增(若有) | 同上 |
|
||||
| 例外 | 物资盘点相关弹窗 | **仍为 11px 紧凑**,未变大 |
|
||||
|
||||
- [ ] **Step 2: 记录异常**
|
||||
|
||||
若发现某弹窗仍偏松:查是否未用 `dialog-form-layout` 且未用 `.form-grid*`,把该类选择器补进 Task 2 兜底或给该弹窗加 `dialog-form-layout`。
|
||||
|
||||
---
|
||||
|
||||
### Task 5: 文档与 OpenSpec 对齐
|
||||
|
||||
**Files:**
|
||||
- Modify: `docs/web-admin-ui-spec-fresh-mint.md`
|
||||
- Modify(若存在对应句): `openspec/changes/zkxw-engineering-standards/specs/ui-conventions/spec.md`
|
||||
|
||||
- [ ] **Step 1: 改 UI 规范**
|
||||
|
||||
在 `docs/web-admin-ui-spec-fresh-mint.md`:
|
||||
|
||||
- §10.1 `.field` label:将 `500`、`margin-bottom: 6px` 改为 **`400`**、**`padding/margin 与控件间距 4px`**(表述与实现一致:`padding-bottom: 4px`)。
|
||||
- 弹窗表单章节(§9 附近若写 label 字重/间距):同步为 400 / 4px;注明栅格内 `el-form-item` `margin-bottom: 0`。
|
||||
- 增加一句例外:物资盘点等紧凑 11px label 可保留局部样式。
|
||||
|
||||
- [ ] **Step 2: OpenSpec**
|
||||
|
||||
若 `ui-conventions/spec.md` 写有 label `500` 或 `6px`,改为与上一致;否则跳过。
|
||||
|
||||
- [ ] **Step 3: Commit**
|
||||
|
||||
```bash
|
||||
git add docs/web-admin-ui-spec-fresh-mint.md \
|
||||
openspec/changes/zkxw-engineering-standards/specs/ui-conventions/spec.md \
|
||||
docs/superpowers/specs/2026-10-10-dialog-label-top-spacing-unify-design.md \
|
||||
docs/superpowers/plans/2026-10-10-dialog-label-top-spacing-unify.md
|
||||
git commit -m "$(cat <<'EOF'
|
||||
docs: align dialog label-top spacing rules with Fresh Mint
|
||||
|
||||
Document 4px gap, weight 400, form-grid margin reset, and stock-check exception.
|
||||
EOF
|
||||
)"
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Spec coverage check
|
||||
|
||||
| Spec 项 | Task |
|
||||
|---------|------|
|
||||
| label 4px / 400 / height auto | Task 1 |
|
||||
| `.form-grid` + `form-grid-*` margin 0 | Task 2 |
|
||||
| dialog 无栅格兜底 | Task 2 |
|
||||
| 清理自建 form-grid 冲突 | Task 3 |
|
||||
| 盘点 11px 例外 | Task 3/4 明确不改 |
|
||||
| 业务域抽检 | Task 4 |
|
||||
| 文档 / OpenSpec | Task 5 |
|
||||
@@ -0,0 +1,124 @@
|
||||
# 弹窗 label-top 间距与字重统一
|
||||
|
||||
> 状态:已确认
|
||||
> 日期:2026-10-10
|
||||
> 范围:web-admin 全部 `label-position="top"` 弹窗(方案 B)
|
||||
> 界面模式:P01/P02 等 CRUD / 业务表单弹窗(不改查看键值区)
|
||||
|
||||
## 1. 背景与目标
|
||||
|
||||
### 1.1 现状
|
||||
|
||||
预签约订单等弹窗已通过**全局样式**收紧上下布局间距,规则落在:
|
||||
|
||||
- `web-admin/src/assets/styles/core/el-ui.scss`:`.el-form--label-top .el-form-item__label`
|
||||
- `web-admin/src/assets/styles/core/app.scss`:`.form-grid-2`~`.form-grid-5` 内 `> .el-form-item { margin-bottom: 0 }`
|
||||
|
||||
仍未完全对齐的点:
|
||||
|
||||
1. 自建 `.form-grid` / `.form-grid--col*`(协议、捐赠、试点申请、渠道、接待等)未必吃到 `form-grid-2~5` 的 `margin-bottom: 0`。
|
||||
2. 部分弹窗未用栅格,仍叠 Element Plus 默认 `el-form-item` 下边距(约 18px)。
|
||||
3. UI 文档仍写 label `font-weight: 500`、`margin-bottom: 6px`,与现实现不一致。
|
||||
|
||||
### 1.2 目标
|
||||
|
||||
所有 **`label-position="top"`** 的弹窗表单统一为:
|
||||
|
||||
| 项 | 值 |
|
||||
|----|-----|
|
||||
| label ↔ 控件间距 | **4px**(label `padding-bottom`) |
|
||||
| label 字重 | **400** |
|
||||
| label 行高 | `auto` / `line-height: 1.4`(禁止沿用左侧 label 的 36px 高度) |
|
||||
| 栅格行距 | 仅靠 grid **`gap`**(规范约 `12px` 纵向);栅格内 `el-form-item` **`margin-bottom: 0`** |
|
||||
|
||||
### 1.3 非目标
|
||||
|
||||
- 不改查看弹窗「上 label 下 value」键值区(`view-kv` 等)。
|
||||
- 不改筛选区左右布局 label(`.filter-form:not(.el-form--label-top)`)。
|
||||
- 不做 DialogForm 组件大重构。
|
||||
- **保留例外**:物资盘点等**紧凑 11px label**(库存/盘点子弹窗内已有独立样式),不强制改成 13px / 4px。
|
||||
|
||||
## 2. 视觉与样式规则
|
||||
|
||||
### 2.1 权威实现(全局)
|
||||
|
||||
```scss
|
||||
.el-form--label-top .el-form-item__label {
|
||||
height: auto !important;
|
||||
line-height: 1.4 !important;
|
||||
font-size: 13px !important;
|
||||
font-weight: 400 !important;
|
||||
color: var(--mint-text) !important;
|
||||
padding: 0 0 4px !important;
|
||||
margin-bottom: 0 !important;
|
||||
}
|
||||
```
|
||||
|
||||
### 2.2 栅格行距
|
||||
|
||||
- 标准类:`.form-grid-2`~`.form-grid-5`(已实现 `> .el-form-item { margin-bottom: 0 }`)。
|
||||
- 扩展:凡弹窗内自建 **`.form-grid`**(含 `--col*`)同样 `margin-bottom: 0`(全局或各页删冗余后依赖全局)。
|
||||
- 弹窗内无栅格的 `label-top` 表单:在 `.el-dialog` / `.dialog-form-layout` 下兜底收紧 `el-form-item` 纵向间距,避免默认 18px 过大(具体数值在实施计划中给出,建议与 gap 体系接近,如 `margin-bottom: 12px` 或栅格外也归零后由区块自身 margin 控制)。
|
||||
|
||||
### 2.3 刻意例外(SHALL 保留)
|
||||
|
||||
以下场景**不得**被全局规则强行覆盖为 13px/4px 标准(若局部已更紧凑则保留):
|
||||
|
||||
- 物资 / 试剂 / 耗材 / 质检物料等**盘点、库存出入**弹窗中的紧凑字段(典型:`font-size: 11px`、`padding-bottom: 2px`、muted 色)。
|
||||
- 行内左 label 字段(如协议「协议总金额」`label-position="left"`)。
|
||||
|
||||
识别方式:页面 scoped 中明确为盘点/库存卡片的 label 覆盖;实施时以「不删除这些覆盖」为准。
|
||||
|
||||
## 3. 分阶段落地
|
||||
|
||||
### Phase 1 — 全局补强
|
||||
|
||||
1. 确认并保留 `el-ui.scss` label-top 规则(4px / 400)。
|
||||
2. `app.scss`:将栅格内 `margin-bottom: 0` 扩展到通用 `.form-grid`(与 `form-grid-2~5` 共用选择器或并列)。
|
||||
3. 为 `.el-dialog.dialog-form-layout`(或更广的 `.el-dialog` 内 `.el-form--label-top`)增加无栅格场景的行距兜底。
|
||||
|
||||
### Phase 2 — 清冲突(少量文件)
|
||||
|
||||
扫描弹窗 scoped 中会盖掉全局的规则:
|
||||
|
||||
- 自建 `.form-grid` 若仅重复全局能力 → 可删 `margin-bottom` 相关重复,**不必**强行改各页 `gap`(协议等已用 `12px 16px` 可保留)。
|
||||
- 弹窗内强制 `font-weight: 500` / 36px label 高度且针对 `label-top` → 删除或改为依赖全局。
|
||||
- **不碰** `.filter-form` 与盘点紧凑 label。
|
||||
|
||||
优先文件(自建 `.form-grid` 已知):
|
||||
|
||||
- `ProtocolFormDialog.vue`、`DonationFormDialog.vue`
|
||||
- `ApplicationFormDialog.vue`、`channel/index.vue`
|
||||
- `ScheduleEditDialog.vue`、样本接待相关弹窗等
|
||||
|
||||
### Phase 3 — 按业务域抽检
|
||||
|
||||
每域抽 1~2 个 `label-top` 弹窗目视确认:
|
||||
|
||||
| 域 | 代表 |
|
||||
|----|------|
|
||||
| 系统管理 | 单位、用户 |
|
||||
| 细胞存储 | 预签约(已验)、协议表单 |
|
||||
| 试点服务 | 申请表单、渠道 |
|
||||
| 生产 / 质检 | 各 1 个标准 CRUD 弹窗 |
|
||||
| OA | 收款账户或小型表单弹窗 |
|
||||
| 例外抽检 | 任一物资盘点弹窗:确认仍为 11px 紧凑 |
|
||||
|
||||
### Phase 4 — 文档对齐
|
||||
|
||||
更新:
|
||||
|
||||
- `docs/web-admin-ui-spec-fresh-mint.md`:弹窗 / `.field` label 字重与间距改为 **400**、**4px**;注明栅格内 `margin-bottom: 0`。
|
||||
- 必要时同步 OpenSpec `ui-conventions` 中对应 SHALL 句。
|
||||
|
||||
## 4. 验收标准
|
||||
|
||||
1. 任意标准 CRUD `label-top` 弹窗:label–控件约 4px,字重常规,行距无明显「双倍空白」。
|
||||
2. 使用自建 `.form-grid` 的大表单弹窗与标准 `form-grid-*` 观感一致(行距不因默认 margin 叠加而偏大)。
|
||||
3. 筛选区、查看键值区、盘点紧凑 label **外观不变**。
|
||||
4. 文档与代码一致。
|
||||
|
||||
## 5. 风险
|
||||
|
||||
- 全局扩大 `margin-bottom: 0` 到 `.form-grid` 时,若某页依赖默认下边距做区块分隔,需靠区块自身 `margin`/`padding` 补偿(Phase 2 抽检时处理)。
|
||||
- `!important` 已用于 label-top:本地未加 `!important` 的覆盖会被全局盖住;盘点类若需保留须确认选择器优先级足够(现状盘点多为更具体 scoped 选择器 + 未与全局冲突的字号色值)。
|
||||
Reference in new issue
Block a user