fix: 修复国际进港原始舱单接口解析及列表项布局规范
- API返回类型从BaseResultBean<PageInfo>改为PageInfo,匹配服务端实际响应 - GjjAirManifest字段maWbList重命名为maWb匹配JSON键名 - 列表项布局weight和completeSpace按国际出港规范对齐 - 移除页面初始自动加载,需用户输入航班号后手动查询 - CLAUDE.md补充列表项布局规范及常用字段weight参考表 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
127
CLAUDE.md
127
CLAUDE.md
@@ -146,6 +146,133 @@ class XxxViewModel : BasePageViewModel() {
|
||||
|
||||
**参考文件**: `module_gjc/.../GjcBoxWeighingActivity.kt`、`GjcBoxWeighingViewModel.kt`
|
||||
|
||||
#### 列表项布局规范 (`item_xxx.xml`)
|
||||
|
||||
**整体结构**: 水平 LinearLayout → 左侧图标 + 中间内容区(多行 KV)+ 右侧箭头
|
||||
|
||||
```xml
|
||||
<androidx.appcompat.widget.LinearLayoutCompat
|
||||
android:id="@+id/ll"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginHorizontal="15dp"
|
||||
android:layout_marginVertical="5dp"
|
||||
android:background="@drawable/bg_item"
|
||||
android:orientation="horizontal"
|
||||
android:padding="10dp">
|
||||
|
||||
<!-- 左侧图标(普通列表用 img_plane,多选列表用 img_plane/img_plane_s 切换) -->
|
||||
<ImageView
|
||||
android:id="@+id/iv_icon"
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="40dp"
|
||||
android:layout_gravity="center"
|
||||
android:src="@drawable/img_plane" />
|
||||
|
||||
<!-- 中间内容区 -->
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_weight="1"
|
||||
android:orientation="vertical">
|
||||
|
||||
<!-- 第一行 KV -->
|
||||
<androidx.appcompat.widget.LinearLayoutCompat
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
<!-- KV 组件(见下方单个 KV 模板) -->
|
||||
</androidx.appcompat.widget.LinearLayoutCompat>
|
||||
|
||||
<!-- 第二行 KV(marginTop=10dp) -->
|
||||
<androidx.appcompat.widget.LinearLayoutCompat
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="10dp">
|
||||
<!-- KV 组件(weight 和 completeSpace 必须与第一行对应位置相同) -->
|
||||
</androidx.appcompat.widget.LinearLayoutCompat>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<!-- 右侧箭头(固定写法) -->
|
||||
<ImageView
|
||||
android:layout_width="30dp"
|
||||
android:layout_height="30dp"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:src="@drawable/img_pda_right" />
|
||||
|
||||
</androidx.appcompat.widget.LinearLayoutCompat>
|
||||
```
|
||||
|
||||
**单个 KV 组件模板**:
|
||||
```xml
|
||||
<androidx.appcompat.widget.LinearLayoutCompat
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1.0"
|
||||
android:gravity="center_vertical">
|
||||
|
||||
<TextView
|
||||
completeSpace="@{5}"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="标签名:" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@{bean.fieldName}" />
|
||||
|
||||
</androidx.appcompat.widget.LinearLayoutCompat>
|
||||
```
|
||||
|
||||
**关键对齐规则**:
|
||||
|
||||
| 规则 | 说明 | 示例 |
|
||||
|------|------|------|
|
||||
| **列 weight 一致** | 第一行和第二行**相同位置**的 KV 组件必须使用相同的 `layout_weight` | 第一行第 1 列 `weight=1.0`,第二行第 1 列也必须 `weight=1.0` |
|
||||
| **列 completeSpace 取最大值** | 同一列位置的 completeSpace 取两行中**较大**的那个值(1 个汉字 = 1 宽度,1 个标点 = 1 宽度) | 第一行"运单号:"=4,第二行"特码:"=3 → 两行都用 `completeSpace=4` |
|
||||
| **右侧箭头统一** | 固定使用 `@drawable/img_pda_right`,尺寸 `30x30dp`,`layout_gravity="center"`,`marginLeft="10dp"` | — |
|
||||
|
||||
**completeSpace 计算方法**: 统计 Label 字符数(含冒号),每个汉字算 1,每个标点(:)算 1。示例:
|
||||
- "运单号:" = 3字 + 1标点 = 4
|
||||
- "运单类型:" = 4字 + 1标点 = 5
|
||||
- "状态:" = 2字 + 1标点 = 3
|
||||
- "始发站:" = 3字 + 1标点 = 4(注:此处"始发站:"虽然有4个字符位,但":"也要占1个宽度)
|
||||
|
||||
同列两行的 completeSpace 统一取 `max(row1, row2)`。例如第 1 列:row1"运单号:"=4,row2"特码:"=3 → 两行都用 4。
|
||||
|
||||
**常用字段 weight 参考表**(基于国际出港模块统计):
|
||||
|
||||
| 字段类型 | 典型 weight | 常见范围 | 典型 completeSpace |
|
||||
|----------|------------|----------|-------------------|
|
||||
| 运单号 | 1.0 | 0.9~1.2 | 4 |
|
||||
| 件数 | 1.2 | 0.8~1.2 | 3~5 |
|
||||
| 重量 | 0.8 | 0.7~1.0 | 3~5 |
|
||||
| 状态 | 0.8 | 0.7~0.8 | 3~4 |
|
||||
| 代理 | 0.8 | 0.7~0.8 | 3~4 |
|
||||
| 特码 | 1.0 | 0.9~1.0 | 3~4 |
|
||||
| 始发站/目的站 | 0.8 | 0.7~0.8 | 4 |
|
||||
| 运单类型/业务类型 | 1.2 | 1.0~1.2 | 5 |
|
||||
| 分单数 | 0.8 | 0.6~0.8 | 4 |
|
||||
| 航班号/航班 | 1.0~1.2 | 1.0~1.2 | 4~5 |
|
||||
| 时间类(入库/离港/过磅) | 1.0~1.2 | 1.0~1.2 | 5 |
|
||||
|
||||
> **原则**: 相同字段在不同页面应使用相近的 weight,优先参照同模块已有布局。若新页面与已有页面**字段完全相同**,应直接复用其 weight 和 completeSpace 配置。
|
||||
|
||||
**典型 weight 分布示例**(5列,运单号/状态/代理/件数/重量 + 特码/始发站/目的站/运单类型/分单数):
|
||||
|
||||
```
|
||||
位置: 第1列 第2列 第3列 第4列 第5列
|
||||
weight: 1.0 0.8 0.8 1.2 0.8 ← 第一行
|
||||
weight: 1.0 0.8 0.8 1.2 0.8 ← 第二行(必须相同)
|
||||
cSpace: 4 4 4 5 4 ← 第一行
|
||||
cSpace: 4 4 4 5 4 ← 第二行(必须相同,取 max)
|
||||
```
|
||||
|
||||
**参考文件**: `module_gjc/.../item_int_exp_tally.xml`(典型)、`item_gjc_query.xml`、`item_gjc_box_weighing.xml`
|
||||
|
||||
---
|
||||
|
||||
### 类型 2:多选列表 + 批量操作页
|
||||
|
||||
Reference in New Issue
Block a user