Compare commits
30 Commits
9e0a26f3bc
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| 623ebc22f7 | |||
| 1157a0c4ed | |||
| 6ad7f0d3d4 | |||
| 9d7453d3ee | |||
| 60478327e2 | |||
| 1d2b11bfd2 | |||
| 4117cbb489 | |||
| 4451b790de | |||
| 1fa0f6dde4 | |||
| faf343301f | |||
| 27d6e55cbe | |||
| 262ce8f099 | |||
| c7ab89b836 | |||
| ecbe7d9a5c | |||
| 1ec08b4847 | |||
| 2c7cf0c255 | |||
| 2865e2fd2d | |||
| 76ace545cd | |||
| cf8a7f38fb | |||
| 52171c94df | |||
| 39934df970 | |||
| 624331ca68 | |||
| 3e5f185721 | |||
| 936af73ec0 | |||
| 43acf0a2de | |||
| c9625f6bfd | |||
| 67b2dc6d71 | |||
| bfc39b5d96 | |||
| fcf5b7ac02 | |||
| da5137887c |
159
.claude.local.md
Normal file
159
.claude.local.md
Normal file
@@ -0,0 +1,159 @@
|
|||||||
|
# 首页菜单页面地图
|
||||||
|
|
||||||
|
> **重要**:修改任何业务页面前,先在此处确认目标 Activity 是否为当前活跃页面。
|
||||||
|
> 若存在新旧两个同名/近名实现,以本文件中列出的为准(旧版已加 `@Deprecated`)。
|
||||||
|
>
|
||||||
|
> 菜单入口代码:`app/src/main/java/com/lukouguoji/aerologic/ui/fragment/HomeFragment.kt`
|
||||||
|
> 路由常量:`module_base/src/main/java/com/lukouguoji/module_base/router/ARouterConstants.kt`
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 一级菜单总览
|
||||||
|
|
||||||
|
| 菜单ID | 名称 | 模块 |
|
||||||
|
|--------|------|------|
|
||||||
|
| `DomExp` | 国内出港 | `module_gnc` |
|
||||||
|
| `DomImp` | 国内进港 | `app/page/gnj` |
|
||||||
|
| `IntExp` | 国际出港 | `module_gjc` |
|
||||||
|
| `IntImp` | 国际进港 | `module_gjj` |
|
||||||
|
| `Flight` | 航班查询 | `module_hangban` |
|
||||||
|
| `CargoStatus` | 货物追踪 | `module_cargo` |
|
||||||
|
| `Supervision` | 监装监卸 | `module_mit` + `app/page` |
|
||||||
|
| `Comprehensive` | 综合管理 | `app/page` |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 国内出港(DomExp)& 国内进港(DomImp)
|
||||||
|
|
||||||
|
> ⛔ **不在维护范围内**:国内出港(`module_gnc`)和国内进港(`module_gnj` / `app/page/gnj`)不会涉及历史修改,也不会有新的需求。**无需关注这两个模块的任何页面。**
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 国际出港(IntExp)
|
||||||
|
|
||||||
|
路由前缀:`/gjc/`
|
||||||
|
|
||||||
|
### 二级菜单
|
||||||
|
|
||||||
|
| 菜单名 | 权限ID | Activity | 路由常量 |
|
||||||
|
|--------|--------|----------|---------|
|
||||||
|
| 收运检查 | `AppIntExpInspection` | `GjcInspectionActivity` | `ACTIVITY_URL_GJC_INSPECTION` |
|
||||||
|
| 出港计重 | `AppIntExpCheckWeighing` | `GjcWeighingListActivity` | `ACTIVITY_URL_GJC_WEIGHING_LIST` |
|
||||||
|
| 出港运抵 | `AppIntExpArrive` | `IntExpArriveActivity` | `ACTIVITY_URL_INT_EXP_ARRIVE` |
|
||||||
|
| 组装分配 | `AppIntExpAssembleAllocate` | `GjcAssembleAllocateActivity` | `ACTIVITY_URL_GJC_ASSEMBLE_ALLOCATE` |
|
||||||
|
| 出港组装 | `AppIntExpAssemble` | `IntExpAssembleActivity` | `ACTIVITY_URL_INT_EXP_ASSEMBLE` |
|
||||||
|
| 板箱过磅 | `GjcFuBangActivity`(权限ID,非类名)| `GjcBoxWeighingActivity` | `ACTIVITY_URL_GJC_BOX_WEIGHING` |
|
||||||
|
| 出港装载 | `AppIntExpLoad` | `IntExpLoadActivity` | `ACTIVITY_URL_INT_EXP_LOAD` |
|
||||||
|
| 出库交接 | `AppIntExpOutHandover` | `IntExpOutHandoverActivity` | `ACTIVITY_URL_INT_EXP_OUT_HANDOVER` |
|
||||||
|
| 出港理货 | `AppIntExpTally` | `IntExpTallyActivity` | `ACTIVITY_URL_INT_EXP_TALLY` |
|
||||||
|
| 出港移库 | `AppIntExpMove` | `IntExpMoveActivity` | `ACTIVITY_URL_INT_EXP_MOVE` |
|
||||||
|
| 出港仓库 | `AppIntExpStorageUse` | `IntExpStorageUseActivity` | `ACTIVITY_URL_INT_EXP_STORAGE_USE` |
|
||||||
|
| 出港查询 | `AppIntExpSearch` | `GjcQueryListActivity` | `ACTIVITY_URL_GJC_QUERY_LIST` |
|
||||||
|
|
||||||
|
> ⚠️ 旧版文件(已加 `@Deprecated`):`GjcFuBangActivity`(`module_gjc/.../activity/`),已被 `GjcBoxWeighingActivity` 替代
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 国际进港(IntImp)
|
||||||
|
|
||||||
|
路由前缀:`/gjj/`
|
||||||
|
|
||||||
|
### 二级菜单
|
||||||
|
|
||||||
|
| 菜单名 | 权限ID | Activity | 路由常量 |
|
||||||
|
|--------|--------|----------|---------|
|
||||||
|
| 电报解析 | `AppIntImpMsgParse` | `IntImpMsgParseActivity` | `ACTIVITY_URL_INT_IMP_MSG_PARSE` |
|
||||||
|
| 进港舱单 | `AppIntImpManifest` | `IntImpManifestActivity` | `ACTIVITY_URL_INT_IMP_MANIFEST` |
|
||||||
|
| 原始舱单 | `AppIntArrAirManifest` | `IntArrAirManifestActivity` | `ACTIVITY_URL_INT_ARR_AIR_MANIFEST` |
|
||||||
|
| 理货报告 | `AppIntImpTally` | `IntImpTallyActivity` | `ACTIVITY_URL_INT_IMP_TALLY` |
|
||||||
|
| 进港仓库 | `AppIntImpWareHouse` | `GjjWareHouseActivity` | `ACTIVITY_URL_GJJ_WARE_HOUSE` |
|
||||||
|
| 提取记录 | `AppIntImpPickUpRecord` | `IntImpPickUpRecordActivity` | `ACTIVITY_URL_INT_IMP_PICK_UP_RECORD` |
|
||||||
|
| 提取出库 | `AppIntImpPickUpDLV` | `IntImpPickUpDLVActivity` | `ACTIVITY_URL_INT_IMP_PICK_UP_DLV` |
|
||||||
|
| 进港查询 | `AppIntImpSearch` | `IntImpQueryActivity` ⚡ | `ACTIVITY_URL_GJJ_QUERY_LIST` |
|
||||||
|
| 事故签证 | `AppIntImpAccidentVisa` | `IntImpAccidentVisaActivity` | `ACTIVITY_URL_INT_IMP_ACCIDENT_VISA` |
|
||||||
|
|
||||||
|
### 三级页面(进港舱单)
|
||||||
|
|
||||||
|
| 页面名 | Activity | 说明 |
|
||||||
|
|--------|----------|------|
|
||||||
|
| 舱单列表(入口) | `IntImpManifestActivity` | 二级入口页 |
|
||||||
|
| 舱单子列表 | `GjjManifestListActivity` | 活跃,独立路由 `ACTIVITY_URL_GJJ_MANIFEST` |
|
||||||
|
| 舱单详情 | `GjjManifestDetailsActivity` / `IntImpManifestDetailsActivity` | 两个活跃详情页 |
|
||||||
|
| 分单编辑 | `GjjManifestAddActivity` / `IntImpManifestSubEditActivity` | 活跃编辑页 |
|
||||||
|
|
||||||
|
### 三级页面(进港查询)
|
||||||
|
|
||||||
|
| 页面名 | Activity | 说明 |
|
||||||
|
|--------|----------|------|
|
||||||
|
| 查询列表(入口) | `IntImpQueryActivity` | 二级入口页(注意:非 GjjQueryListActivity)|
|
||||||
|
| 查询详情 | `IntImpQueryDetailsActivity` | 活跃 |
|
||||||
|
| 运单修改 | `IntImpQueryEditActivity` | 活跃 |
|
||||||
|
|
||||||
|
> ⚠️ 旧版(已加 `@Deprecated`):`GjjQueryListActivity`、`GjjQueryInfoActivity`
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 航班查询(Flight)
|
||||||
|
|
||||||
|
直接跳转,无二级菜单。
|
||||||
|
|
||||||
|
| Activity | 路由 | 文件路径 |
|
||||||
|
|----------|------|---------|
|
||||||
|
| `HbQueryListActivity` | `/hb/HbQueryListActivity` | `module_hangban/...` |
|
||||||
|
|
||||||
|
> ⚠️ 旧版:`FlightQueryListActivity`(`app/.../page/flight/query/list/`)已加 `@Deprecated`,由 HomeFragment 注释确认废弃
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 货物追踪(CargoStatus)
|
||||||
|
|
||||||
|
直接跳转,无二级菜单。
|
||||||
|
|
||||||
|
| Activity | 路由 |
|
||||||
|
|----------|------|
|
||||||
|
| `CargoTrackingActivity` | `/cg/CargoTrackingActivity` |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 监装监卸(Supervision)
|
||||||
|
|
||||||
|
### 二级菜单
|
||||||
|
|
||||||
|
| 菜单名 | 权限ID | Activity | 文件路径 |
|
||||||
|
|--------|--------|----------|---------|
|
||||||
|
| 进港卸机 | `AppImpLoad` | `GnjUnloadListActivity` | `app/.../page/gnj/unload/list/` |
|
||||||
|
| 事故签证(监装) | `AppAccidentVisa` | `AccidentVisaActivity` | 路由 `/mit/AccidentVisaActivity` |
|
||||||
|
| 事故签证(综合) | `AppComprehensiveAccidentVisa` | `AccidentVisaListActivity` | `app/.../page/accident/visa/list/` |
|
||||||
|
| 出港装板 | `AppExpLoad` | `OutLoadingActivity` | 路由 `/mit/OutLoadingActivity` |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 综合管理(Comprehensive)
|
||||||
|
|
||||||
|
### 二级菜单
|
||||||
|
|
||||||
|
| 菜单名 | 权限ID | Activity | 文件路径 |
|
||||||
|
|--------|--------|----------|---------|
|
||||||
|
| 消息管理 | `AppComprehensiveMessage` | `MessageListActivity` | `app/.../page/message/list/` |
|
||||||
|
| 电报管理 | `AppComprehensiveTelegram` | `TelegramListActivity` | `app/.../page/telegram/list/` |
|
||||||
|
| 货物转运 | `AppComprehensiveTransfer` | `GoodsTransportActivity` | `app/.../page/transport/` |
|
||||||
|
| 平板车管理 | `AppComprehensiveCar` | `CarListActivity` | `app/.../page/car/list/` |
|
||||||
|
| 日志查询 | `AppComprehensiveLog` | `LogQueryActivity` | `app/.../page/log/list/` |
|
||||||
|
| 转运记录 | `AppTransportLog` | `TransportLogActivity` | `app/.../page/transportLog/list/` |
|
||||||
|
| ULD管理 | `AppComprehensiveUld` | `UldListActivity` | `app/.../page/uld/list/` |
|
||||||
|
| 冷库登记 | `AppComprehensiveColdStorage` | `ColdStorageActivity` | `app/.../page/coldStorage/list/` |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 废弃页面清单(已加 @Deprecated)
|
||||||
|
|
||||||
|
以下页面确认废弃,勿修改、勿参考:
|
||||||
|
|
||||||
|
| 废弃类名 | 文件路径 | 替代页面 | 依据 |
|
||||||
|
|----------|---------|---------|------|
|
||||||
|
| `FlightQueryListActivity` | `app/.../page/flight/query/list/` | `HbQueryListActivity` | HomeFragment 注释"已废弃" |
|
||||||
|
| `HangBanQueryActivity` | `module_hangban/.../activity/` | `HbQueryListActivity` | 路由注释"已废弃,使用 HbQueryListActivity" |
|
||||||
|
| `HangBanQueryInfoActivity` | `module_hangban/.../activity/` | — | 仅被废弃的 HangBanQueryActivity 调用,实际不可达 |
|
||||||
|
| `GjcFuBangActivity` | `module_gjc/.../activity/` | `GjcBoxWeighingActivity` | HomeFragment 注释"旧版跳转" |
|
||||||
|
| `GjjQueryListActivity` | `module_gjj/.../activity/` | `IntImpQueryActivity` | 路由被注释,IntImpQueryActivity 接管同一路由 |
|
||||||
|
| `GjjQueryInfoActivity` | `module_gjj/.../activity/` | `IntImpQueryDetailsActivity` | 路由注释"已替换为 IntImpQueryDetailsActivity" |
|
||||||
@@ -115,13 +115,36 @@
|
|||||||
"mcp__plugin_claude-mem_mcp-search__smart_search",
|
"mcp__plugin_claude-mem_mcp-search__smart_search",
|
||||||
"Bash(echo \"exit:$?\")",
|
"Bash(echo \"exit:$?\")",
|
||||||
"mcp__apifox__read_project_oas_j7j64k",
|
"mcp__apifox__read_project_oas_j7j64k",
|
||||||
"mcp__apifox__read_project_oas_ref_resources_j7j64k"
|
"mcp__apifox__read_project_oas_ref_resources_j7j64k",
|
||||||
|
"mcp__apifox__read_project_oas_ruugy8",
|
||||||
|
"mcp__apifox__read_project_oas_ref_resources_ldmedm",
|
||||||
|
"mcp__apifox__read_project_oas_ldmedm",
|
||||||
|
"mcp__apifox__refresh_project_oas_ldmedm",
|
||||||
|
"Skill(update-config)",
|
||||||
|
"mcp__apidoc__get_project_overview",
|
||||||
|
"mcp__apidoc__search_endpoints",
|
||||||
|
"mcp__apidoc__list_endpoints",
|
||||||
|
"mcp__apidoc__get_endpoint_detail",
|
||||||
|
"mcp__api-doc__search_endpoints",
|
||||||
|
"mcp__api-doc__get_endpoint_detail",
|
||||||
|
"mcp__api-doc__list_modules",
|
||||||
|
"mcp__api-doc__list_endpoints",
|
||||||
|
"Bash(sed -n '11,15p' /Users/kid/Development/Fusion/Projects/aerologic-app/app/src/main/java/com/lukouguoji/aerologic/page/flight/query/list/FlightQueryListActivity.kt)",
|
||||||
|
"Bash(sed -n '23,27p' /Users/kid/Development/Fusion/Projects/aerologic-app/module_gjc/src/main/java/com/lukouguoji/gjc/activity/GjcFuBangActivity.kt)",
|
||||||
|
"Bash(sed -i '' '/@Deprecated\\(\"旧版国内出港出库,已由 Gnc 前缀新版页面替代\"\\)/d' /Users/kid/Development/Fusion/Projects/aerologic-app/module_gnc/src/main/java/com/lukouguoji/gnc/activity/GoutChuKuListActivity.kt)",
|
||||||
|
"Bash(sed -i '' '/@Deprecated\\(\"旧版国内出港收运,已由 Gnc 前缀新版页面替代\"\\)/d' /Users/kid/Development/Fusion/Projects/aerologic-app/module_gnc/src/main/java/com/lukouguoji/gnc/activity/GoutCollectionActivity.kt)",
|
||||||
|
"Bash(sed -i '' '/@Deprecated\\(\"旧版国内出港复磅,使用 GncFuBangListActivity 替代\"\\)/d' /Users/kid/Development/Fusion/Projects/aerologic-app/module_gnc/src/main/java/com/lukouguoji/gnc/activity/GoutFuBangActivity.kt)",
|
||||||
|
"Bash(sed -i '' '/@Deprecated\\(\"旧版国内出港复磅(组合),使用 GncFuBangListActivity 替代\"\\)/d' /Users/kid/Development/Fusion/Projects/aerologic-app/module_gnc/src/main/java/com/lukouguoji/gnc/activity/GoutFuBangCotActivity.kt)",
|
||||||
|
"Bash(sed -i '' '/@Deprecated\\(\"旧版国内出港收运开始,使用 GncShouYunUnListActivity 替代\"\\)/d' /Users/kid/Development/Fusion/Projects/aerologic-app/module_gnc/src/main/java/com/lukouguoji/gnc/activity/GoutStartCotActivity.kt)"
|
||||||
],
|
],
|
||||||
"deny": [],
|
"deny": [],
|
||||||
"ask": []
|
"ask": []
|
||||||
},
|
},
|
||||||
|
"enableAllProjectMcpServers": true,
|
||||||
"enabledMcpjsonServers": [
|
"enabledMcpjsonServers": [
|
||||||
"空港集团 - API 文档",
|
"空港集团 - API 文档",
|
||||||
"apifox"
|
"apifox",
|
||||||
|
"aerologic-app",
|
||||||
|
"apidoc"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
465
.claude/skills/new-page/SKILL.md
Normal file
465
.claude/skills/new-page/SKILL.md
Normal file
@@ -0,0 +1,465 @@
|
|||||||
|
---
|
||||||
|
name: new-page
|
||||||
|
description: 根据设计截图和菜单入口名称,在 AirLogistics 项目中创建新的业务页面。自动分析截图判断页面类型(6种典型类型之一),规划所需文件,然后完整实现(Kotlin + XML + 路由注册 + 菜单接入)。当用户说"创建页面"、"新建页面"、"实现这个页面"、"做这个页面"或提供设计截图要求开发时触发。
|
||||||
|
---
|
||||||
|
|
||||||
|
# 新建业务页面
|
||||||
|
|
||||||
|
根据设计截图和菜单入口名称,在 AirLogistics 项目中完整创建一个新的业务页面。
|
||||||
|
|
||||||
|
## 前置要求
|
||||||
|
|
||||||
|
用户需要提供:
|
||||||
|
1. **设计截图**(必须)— 页面 UI 设计图
|
||||||
|
2. **菜单入口名称**(必须)— 页面在首页菜单中显示的名称
|
||||||
|
3. **所属模块**(可选)— 如 module_gjj(国际进港)、module_gjc(国际出港)等,可从截图标题推断
|
||||||
|
|
||||||
|
## 执行步骤
|
||||||
|
|
||||||
|
### 第 1 步:分析截图,判定页面类型
|
||||||
|
|
||||||
|
仔细阅读截图,提取以下信息:
|
||||||
|
|
||||||
|
1. **页面标题**(标题栏文字)
|
||||||
|
2. **搜索区字段**(每个搜索控件的 hint 文本、类型:日期/输入/下拉/扫码)
|
||||||
|
3. **列表项字段**(每个数据字段的标签名和显示格式)
|
||||||
|
4. **底部操作栏**(统计项 + 操作按钮)
|
||||||
|
5. **特殊交互**(全选、展开/收起、右箭头、子列表等)
|
||||||
|
|
||||||
|
然后对照 CLAUDE.md 中的 **6 种典型页面类型**判定:
|
||||||
|
|
||||||
|
| 类型 | 关键特征 | 判定依据 |
|
||||||
|
|------|----------|----------|
|
||||||
|
| **类型 1:列表查询页** | 搜索 + 分页列表 + 底部统计 | 无全选、无勾选,纯查看 |
|
||||||
|
| **类型 2:多选列表 + 批量操作页** | 类型 1 + 全选按钮 + 飞机图标选中态 + 操作按钮 | 有全选、有批量操作按钮(如"清除提货") |
|
||||||
|
| **类型 3:嵌套多选列表页** | 类型 2 + 子列表(展开/收起)+ 主子联动全选 | 有展开按钮、列表项内含子 RecyclerView |
|
||||||
|
| **类型 4:Tab 详情页** | 自定义 Tab 栏 + ViewPager2 + 多 Fragment | 有 Tab 切换、无列表搜索 |
|
||||||
|
| **类型 5:编辑表单页** | ScrollView + PadDataLayoutNew 表单 + 保存/取消 | 有可编辑字段、有保存按钮 |
|
||||||
|
| **类型 6:添加表单页** | 类型 5 + 输入回调 + 实时计算 | 有 setRefreshCallBack 联动 |
|
||||||
|
|
||||||
|
**向用户确认**判定结果,格式:
|
||||||
|
|
||||||
|
```
|
||||||
|
📋 页面分析结果:
|
||||||
|
|
||||||
|
页面标题:XXX
|
||||||
|
页面类型:类型 N — XXXX
|
||||||
|
所属模块:module_xxx
|
||||||
|
|
||||||
|
搜索条件:
|
||||||
|
1. XXX(DATE)
|
||||||
|
2. XXX(SPINNER)
|
||||||
|
3. XXX(INPUT + 扫码)
|
||||||
|
|
||||||
|
列表字段(第一行):XXX | XXX | XXX
|
||||||
|
列表字段(第二行):XXX | XXX | XXX
|
||||||
|
|
||||||
|
底部操作:全选 + 统计(合计/总件数/总重量) + [操作按钮名称]
|
||||||
|
|
||||||
|
是否正确?确认后开始实现。
|
||||||
|
```
|
||||||
|
|
||||||
|
### 第 2 步:查找参考模板并提取 UI 设计规范
|
||||||
|
|
||||||
|
根据判定的页面类型,在项目中找到**同类型的最新参考实现**,并严格提取 UI 设计规范。
|
||||||
|
|
||||||
|
**查找策略**(优先级从高到低):
|
||||||
|
1. 优先查找**最近提交的同类型页面**(最新的页面代表最新的 UI 规范)
|
||||||
|
2. 其次在**同模块**内查找同类型页面
|
||||||
|
3. 最后在 **module_gjc**(国际出港)查找
|
||||||
|
|
||||||
|
**最新典型参考页面**(2024年后新增,代表当前 UI 规范):
|
||||||
|
|
||||||
|
| 页面类型 | 参考页面 | 布局文件 |
|
||||||
|
|----------|----------|----------|
|
||||||
|
| 列表查询页 | 航班查询列表 | `activity_flight_query_list.xml` / `item_flight_query_list.xml` |
|
||||||
|
| 列表查询页 | 日志查询页 | `activity_log_query.xml` / `item_log_query.xml` |
|
||||||
|
| 详情页 | 航班查询详情 | `activity_flight_query_details.xml` |
|
||||||
|
| 详情页 | 日志详情 | `activity_log_detail.xml` |
|
||||||
|
|
||||||
|
**必须读取的参考文件**:
|
||||||
|
- 上述最新典型参考页面中**与当前页面类型匹配的布局 XML**(Activity 布局 + Item 布局)
|
||||||
|
- 对应的 Activity、ViewModel、ViewHolder Kotlin 代码
|
||||||
|
- Dialog(如有批量操作弹窗)
|
||||||
|
|
||||||
|
**UI 设计规范提取(必做)**:
|
||||||
|
|
||||||
|
读取参考布局后,必须逐一确认以下规范项,并在开发计划中明确列出:
|
||||||
|
|
||||||
|
| 规范项 | 必须确认的内容 |
|
||||||
|
|--------|---------------|
|
||||||
|
| 页面背景色 | 根容器 `background` 属性(新规范:`@color/color_f2`) |
|
||||||
|
| 搜索区样式 | 使用的搜索控件类型、间距、布局方式 |
|
||||||
|
| 搜索按钮样式 | 图标资源、尺寸、style(新规范:`@drawable/img_search`,36dp) |
|
||||||
|
| 底部栏背景色 | 背景色 + 文字颜色(新规范有两种变体) |
|
||||||
|
| 底部栏文字样式 | 字号、粗细、颜色 |
|
||||||
|
| 列表项背景 | 背景、间距、padding |
|
||||||
|
| 详情页卡片样式 | 背景、圆角、padding、行间距 |
|
||||||
|
| 表单控件 | 使用 PadDataLayoutNew(非旧版 PadDataLayout) |
|
||||||
|
|
||||||
|
**同时检查**:
|
||||||
|
- 该页面需要的**下拉列表数据源 API** 是否已存在(代理人、特码等)
|
||||||
|
- 该页面需要的 **Bean 类**是否已存在,或需要新建
|
||||||
|
- `ARouterConstants` 中是否已有对应路由常量
|
||||||
|
- `Constant.AuthName` 中是否已有对应权限名
|
||||||
|
|
||||||
|
### 第 3 步:制定文件清单
|
||||||
|
|
||||||
|
列出所有需要**新建**和**修改**的文件。
|
||||||
|
|
||||||
|
**新建文件清单**(根据页面类型调整):
|
||||||
|
|
||||||
|
| 类别 | 文件 | 路径 |
|
||||||
|
|------|------|------|
|
||||||
|
| Bean | `XxxBean.kt`(如需) | `module_base/.../bean/` |
|
||||||
|
| Activity | `XxxActivity.kt` | `module_xxx/.../activity/` |
|
||||||
|
| ViewModel | `XxxViewModel.kt` | `module_xxx/.../viewModel/` |
|
||||||
|
| ViewHolder | `XxxViewHolder.kt` | `module_xxx/.../holder/` |
|
||||||
|
| Dialog | `XxxDialogModel.kt`(如需) | `module_xxx/.../dialog/` |
|
||||||
|
| Activity 布局 | `activity_xxx.xml` | `module_xxx/.../res/layout/` |
|
||||||
|
| Item 布局 | `item_xxx.xml` | `module_xxx/.../res/layout/` |
|
||||||
|
| Dialog 布局 | `dialog_xxx.xml`(如需) | `module_xxx/.../res/layout/` |
|
||||||
|
|
||||||
|
**修改文件清单**(固定):
|
||||||
|
|
||||||
|
| 文件 | 修改内容 |
|
||||||
|
|------|----------|
|
||||||
|
| `Api.kt` | 添加 API 接口方法 + import |
|
||||||
|
| `ARouterConstants.kt` | 添加路由常量(如不存在) |
|
||||||
|
| `Constant.kt` | 添加 AuthName 常量(如不存在) |
|
||||||
|
| `AndroidManifest.xml` | 注册 Activity |
|
||||||
|
| `HomeFragment.kt` | 添加菜单项 + 点击路由处理 |
|
||||||
|
| 旧版 Activity(如有) | 注释掉 `@Route` 注解避免冲突 |
|
||||||
|
|
||||||
|
### 第 4 步:创建 Bean(如需)
|
||||||
|
|
||||||
|
如果截图中的列表字段与现有 Bean 不匹配,创建新的 Bean 类。
|
||||||
|
|
||||||
|
**规则**:
|
||||||
|
- 放在 `module_base/.../bean/` 目录下
|
||||||
|
- 如果是类型 2/3(多选),必须包含 `ObservableBoolean` 选中状态:
|
||||||
|
|
||||||
|
```kotlin
|
||||||
|
val checked: ObservableBoolean = ObservableBoolean(false)
|
||||||
|
var isSelected: Boolean
|
||||||
|
get() = checked.get()
|
||||||
|
set(value) = checked.set(value)
|
||||||
|
```
|
||||||
|
|
||||||
|
- 字段类型映射:数字用 `Int/Long/Double`,文本用 `String = ""`,时间用 `String = ""`
|
||||||
|
- 在 `Api.kt` 的 import 区按字母顺序添加 import
|
||||||
|
|
||||||
|
### 第 5 步:添加 API 接口
|
||||||
|
|
||||||
|
在 `Api.kt` 中添加 API 方法。
|
||||||
|
|
||||||
|
**标准 API 组合**(根据页面需要选取):
|
||||||
|
- `getXxxList(@Body)` — 分页查询,返回 `PageInfo<XxxBean>`
|
||||||
|
- `getXxxTotal(@Body)` — 分页合计,返回 `BaseResultBean<ManifestTotalDto>`
|
||||||
|
- 批量操作 API — 返回 `BaseResultBean<Boolean>`
|
||||||
|
- 下拉列表 API(代理人、特码等)— 如不存在则添加
|
||||||
|
|
||||||
|
**API 路径命名**:先使用 `ModuleName/methodName` 格式占位(如 `IntImpPickUpRecord/pageQuery`),后续由第 13 步替换为真实接口路径
|
||||||
|
|
||||||
|
### 第 6 步:添加路由和权限常量
|
||||||
|
|
||||||
|
1. 在 `ARouterConstants.kt` 添加路由(如不存在):
|
||||||
|
```kotlin
|
||||||
|
const val ACTIVITY_URL_XXX = "/module/XxxActivity"
|
||||||
|
```
|
||||||
|
|
||||||
|
2. 在 `Constant.kt` 的 `AuthName` 中添加权限名(如不存在):
|
||||||
|
```kotlin
|
||||||
|
const val XxxPage = "AppXxxPage"
|
||||||
|
```
|
||||||
|
|
||||||
|
### 第 7 步:创建 ViewHolder
|
||||||
|
|
||||||
|
根据 item 布局创建 ViewHolder。
|
||||||
|
|
||||||
|
**类型 1**:基础绑定
|
||||||
|
**类型 2**:增加图标点击切换 `checked` 状态
|
||||||
|
**类型 3**:增加子列表 `setCommonAdapter` + 展开按钮 + 父子联动
|
||||||
|
|
||||||
|
### 第 8 步:创建 ViewModel
|
||||||
|
|
||||||
|
**必须包含的元素**(根据截图):
|
||||||
|
- 搜索条件 `MutableLiveData`(与搜索区对应)
|
||||||
|
- 下拉列表数据源 `MutableLiveData<List<KeyValue>>`
|
||||||
|
- 统计字段 `MutableLiveData<String>`
|
||||||
|
- 适配器配置:`itemViewHolder` + `itemLayoutId`
|
||||||
|
- `searchClick()` 方法
|
||||||
|
- `getData()` override:调用列表 API + 统计 API
|
||||||
|
|
||||||
|
**类型 2 额外**:`isAllChecked` + `checkAllClick()` + 批量操作方法
|
||||||
|
**类型 3 额外**:`isAllExpanded` + `toggleAllExpand()` + 联动全选逻辑
|
||||||
|
|
||||||
|
**下拉列表初始化**:
|
||||||
|
- 代理人:`DictUtils.getAgentList()` / `NetApply.api.getIntImpAgentList()` / `getIntExpAgentList()`
|
||||||
|
- 特码:`DictUtils.getSpecialCodeList(flag, ieFlag, parentcode)`
|
||||||
|
- 其他字典:`DictUtils` 或自定义 API
|
||||||
|
|
||||||
|
### 第 9 步:创建布局文件
|
||||||
|
|
||||||
|
**⚠️ 重要:所有布局必须严格遵循最新 UI 设计规范,参照第 2 步中提取的规范项。**
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
#### 新版 UI 设计规范(强制执行)
|
||||||
|
|
||||||
|
**1. 页面背景色**:
|
||||||
|
```xml
|
||||||
|
<!-- 根容器必须使用 color_f2 背景色 -->
|
||||||
|
<LinearLayout
|
||||||
|
android:background="@color/color_f2"
|
||||||
|
android:orientation="vertical">
|
||||||
|
```
|
||||||
|
|
||||||
|
**2. 搜索区规范**:
|
||||||
|
```xml
|
||||||
|
<!-- 搜索区:marginHorizontal=10dp, marginTop=10dp, gravity=center_vertical -->
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_marginHorizontal="10dp"
|
||||||
|
android:layout_marginTop="10dp"
|
||||||
|
android:gravity="center_vertical">
|
||||||
|
|
||||||
|
<!-- 搜索控件使用 PadSearchLayout -->
|
||||||
|
<PadSearchLayout
|
||||||
|
type="@{SearchLayoutType.DATE}"
|
||||||
|
hint='@{"请选择航班日期"}'
|
||||||
|
icon="@{@drawable/img_date}"
|
||||||
|
value="@={viewModel.date}"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_weight="1" />
|
||||||
|
|
||||||
|
<!-- 搜索按钮:img_search 图标,36x36dp,padding=2dp -->
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:gravity="center_vertical|start"
|
||||||
|
android:paddingHorizontal="24dp">
|
||||||
|
<ImageView
|
||||||
|
android:layout_width="36dp"
|
||||||
|
android:layout_height="36dp"
|
||||||
|
android:padding="2dp"
|
||||||
|
android:onClick="@{()-> viewModel.searchClick()}"
|
||||||
|
android:src="@drawable/img_search" />
|
||||||
|
</LinearLayout>
|
||||||
|
</LinearLayout>
|
||||||
|
```
|
||||||
|
|
||||||
|
**3. 底部统计栏规范**(两种变体,根据截图选择):
|
||||||
|
|
||||||
|
**变体 A — 深蓝色底部栏**(多数列表页使用):
|
||||||
|
```xml
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_height="50dp"
|
||||||
|
android:background="@color/color_bottom_layout"
|
||||||
|
android:gravity="center_vertical"
|
||||||
|
android:paddingHorizontal="15dp">
|
||||||
|
<TextView
|
||||||
|
android:text='@{"合计:"+viewModel.count+"条"}'
|
||||||
|
android:textColor="@color/white"
|
||||||
|
android:textSize="18sp"
|
||||||
|
android:textStyle="bold" />
|
||||||
|
</LinearLayout>
|
||||||
|
```
|
||||||
|
|
||||||
|
**变体 B — 白色底部栏**:
|
||||||
|
```xml
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_height="50dp"
|
||||||
|
android:background="@color/white"
|
||||||
|
android:gravity="center_vertical"
|
||||||
|
android:paddingHorizontal="15dp">
|
||||||
|
<TextView
|
||||||
|
android:text='@{"合计:" + viewModel.count + "条"}'
|
||||||
|
android:textColor="@color/bottom_tool_tips_text_color"
|
||||||
|
android:textSize="18sp"
|
||||||
|
android:textStyle="bold" />
|
||||||
|
</LinearLayout>
|
||||||
|
```
|
||||||
|
|
||||||
|
**4. 详情页/表单页规范**:
|
||||||
|
- 必须使用 **PadDataLayoutNew**(非旧版 PadDataLayout)
|
||||||
|
- 卡片背景:`@drawable/bg_white_radius_8`,padding `15dp`
|
||||||
|
- 行间距:`marginTop="8dp"`
|
||||||
|
- 三列标准布局,每列 `layout_weight="1"`
|
||||||
|
```xml
|
||||||
|
<ScrollView android:fillViewport="true">
|
||||||
|
<LinearLayout android:padding="15dp" android:orientation="vertical">
|
||||||
|
<LinearLayout android:background="@drawable/bg_white_radius_8"
|
||||||
|
android:padding="15dp" android:orientation="vertical">
|
||||||
|
<LinearLayout android:orientation="horizontal">
|
||||||
|
<PadDataLayoutNew layout_weight="1" enable="@{false}"
|
||||||
|
title='@{"航班日期"}' type="@{DataLayoutType.INPUT}"
|
||||||
|
value='@{viewModel.dataBean.fdate}' />
|
||||||
|
<!-- 更多列... -->
|
||||||
|
</LinearLayout>
|
||||||
|
<LinearLayout android:orientation="horizontal" android:layout_marginTop="8dp">
|
||||||
|
<!-- 第二行... -->
|
||||||
|
</LinearLayout>
|
||||||
|
</LinearLayout>
|
||||||
|
</LinearLayout>
|
||||||
|
</ScrollView>
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
#### Activity 布局完整结构
|
||||||
|
|
||||||
|
```xml
|
||||||
|
<layout>
|
||||||
|
<data>
|
||||||
|
<import SearchLayoutType />
|
||||||
|
<variable viewModel />
|
||||||
|
<variable activity /> <!-- 类型 3 或有 Dialog 操作时 -->
|
||||||
|
</data>
|
||||||
|
<LinearLayout background="@color/color_f2" vertical> <!-- ← 新规范:背景色 -->
|
||||||
|
<include title_tool_bar />
|
||||||
|
<!-- 搜索区:marginHorizontal=10dp, marginTop=10dp -->
|
||||||
|
<LinearLayout horizontal marginHorizontal="10dp" marginTop="10dp">
|
||||||
|
PadSearchLayout × N + 搜索按钮(img_search, 36dp) <!-- ← 新规范:搜索按钮 -->
|
||||||
|
</LinearLayout>
|
||||||
|
<!-- 列表 -->
|
||||||
|
<SmartRefreshLayout> <RecyclerView /> </SmartRefreshLayout>
|
||||||
|
<!-- 底部栏:50dp,根据截图选择深蓝/白色变体 --> <!-- ← 新规范:底部栏 -->
|
||||||
|
<LinearLayout height="50dp" background="..." paddingHorizontal="15dp">
|
||||||
|
<TextView textSize="18sp" textStyle="bold" />
|
||||||
|
</LinearLayout>
|
||||||
|
</LinearLayout>
|
||||||
|
</layout>
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Item 布局(从截图精确还原每一行每一列)
|
||||||
|
|
||||||
|
- 逐行对照截图中的字段顺序和标签文本
|
||||||
|
- 使用 `completeSpace` 对齐 Key 文本
|
||||||
|
- 运单号等关键字段用 `@color/colorPrimary`
|
||||||
|
- 类型 2/3 左侧有飞机图标:`loadImage="@{bean.checked.get() ? @drawable/img_plane_s : @drawable/img_plane}"`
|
||||||
|
- 列表项背景统一使用 `@drawable/bg_item`
|
||||||
|
- 间距统一:`marginHorizontal="15dp"`, `marginVertical="5dp"`, `padding="10dp"`
|
||||||
|
|
||||||
|
**关键原则:务必尽可能还原截图上的页面设计,不推测不假想。**
|
||||||
|
|
||||||
|
### 第 10 步:创建 Activity
|
||||||
|
|
||||||
|
**固定结构**:
|
||||||
|
```kotlin
|
||||||
|
@Route(path = ARouterConstants.ACTIVITY_URL_XXX)
|
||||||
|
class XxxActivity : BaseBindingActivity<XxxBinding, XxxViewModel>() {
|
||||||
|
override fun layoutId() = R.layout.activity_xxx
|
||||||
|
override fun viewModelClass() = XxxViewModel::class.java
|
||||||
|
|
||||||
|
override fun initOnCreate(savedInstanceState: Bundle?) {
|
||||||
|
setBackArrow("页面标题") // 与截图标题一致
|
||||||
|
binding.viewModel = viewModel
|
||||||
|
binding.activity = this // 类型 3 或有 Dialog 时
|
||||||
|
|
||||||
|
// 类型 2/3:观察全选状态
|
||||||
|
viewModel.isAllChecked.observe(this) { binding.checkIcon.alpha = if (it) 1.0f else 0.5f }
|
||||||
|
|
||||||
|
// 绑定分页
|
||||||
|
viewModel.pageModel.bindSmartRefreshLayout(binding.srl, binding.rv, viewModel, this)
|
||||||
|
|
||||||
|
// 监听刷新事件
|
||||||
|
FlowBus.with<String>(ConstantEvent.EVENT_REFRESH).observe(this) { viewModel.refresh() }
|
||||||
|
|
||||||
|
// 初始化下拉列表(如有)
|
||||||
|
viewModel.initAgentList()
|
||||||
|
viewModel.initSpecialCodeList()
|
||||||
|
|
||||||
|
viewModel.refresh()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### 第 11 步:注册 Activity + 菜单入口
|
||||||
|
|
||||||
|
1. **AndroidManifest.xml**:在其他 gjj Activity 注册附近添加:
|
||||||
|
```xml
|
||||||
|
<activity android:name="com.lukouguoji.xxx.activity.XxxActivity"
|
||||||
|
android:configChanges="orientation|keyboardHidden"
|
||||||
|
android:exported="false" android:screenOrientation="userLandscape" />
|
||||||
|
```
|
||||||
|
|
||||||
|
2. **HomeFragment.kt**:
|
||||||
|
- 在对应模块的菜单列表区添加 `RightMenu` 项(图标 + 标题)
|
||||||
|
- 在 onClick 处理区添加路由跳转
|
||||||
|
|
||||||
|
3. **旧版 Activity**(如有):注释掉 `@Route` 注解
|
||||||
|
|
||||||
|
### 第 12 步:编译验证
|
||||||
|
|
||||||
|
```bash
|
||||||
|
./gradlew assembleDebug
|
||||||
|
```
|
||||||
|
|
||||||
|
编译必须通过(0 errors)。如有错误,立即修复后重新编译。
|
||||||
|
|
||||||
|
### 第 13 步:查找并对接 API 接口
|
||||||
|
|
||||||
|
页面创建并编译通过后,通过"空港集团 - API 文档"Apifox MCP 工具查找真实接口,替换第 5 步中的占位路径。
|
||||||
|
|
||||||
|
**A. 基础接口查找(每次必查):**
|
||||||
|
|
||||||
|
1. 根据页面所属业务路径(如"国际进港 → 原始舱单"),在 Apifox MCP 中按模块目录搜索
|
||||||
|
2. 查找以下基础接口:
|
||||||
|
- **列表接口**(分页查询,如 `pageQuery`、`list`)
|
||||||
|
- **合计接口**(统计,如 `total`、`count`、`statistics`)
|
||||||
|
- **修改/保存接口**(如 `update`、`save`、`edit`)
|
||||||
|
- **删除接口**(如 `delete`、`remove`)
|
||||||
|
|
||||||
|
**B. 智能接口匹配(根据页面分析):**
|
||||||
|
|
||||||
|
3. 根据**页面类型特性**查找对应接口:
|
||||||
|
- 类型 2(多选批量操作)→ 查找批量操作接口(如批量删除、批量确认等)
|
||||||
|
- 类型 3(嵌套列表)→ 查找子列表相关接口
|
||||||
|
- 类型 5/6(表单页)→ 查找详情查询接口、下拉选项字典接口
|
||||||
|
- 类型 4(Tab 详情)→ 查找各 Tab 对应的数据接口
|
||||||
|
4. 根据**页面中的按钮和文案**,逐一匹配对应接口:
|
||||||
|
- 例如页面有"审核"按钮 → 查找审核接口
|
||||||
|
- 例如页面有"导出"按钮 → 查找导出接口
|
||||||
|
- 例如页面有"打印"按钮 → 查找打印相关接口
|
||||||
|
- 例如底部栏有"清除提货"按钮 → 查找清除提货接口
|
||||||
|
- 例如搜索区有下拉框(代理人、状态等)→ 查找对应的字典/下拉数据接口
|
||||||
|
5. 根据**截图中可见的交互元素**,推断可能需要的接口:
|
||||||
|
- 列表项有右箭头 → 可能需要详情接口
|
||||||
|
- 列表项有编辑图标 → 可能需要编辑/更新接口
|
||||||
|
- 有扫码图标 → 可能需要扫码查询接口
|
||||||
|
|
||||||
|
**C. 对接与校准:**
|
||||||
|
|
||||||
|
6. 找到接口后,更新 `Api.kt` 中的占位路径为真实路径
|
||||||
|
7. 根据接口的请求参数和返回字段结构,校准 Bean 类的字段名和类型
|
||||||
|
8. 遵循 memory 中的 API 搜索原则:不跨模块混用接口,遇到不确定的接口询问用户确认
|
||||||
|
|
||||||
|
### 第 14 步:重新编译验证
|
||||||
|
|
||||||
|
对接真实 API 后重新编译,确保无错误:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
./gradlew assembleDebug
|
||||||
|
```
|
||||||
|
|
||||||
|
编译必须通过(0 errors)。如有错误,立即修复后重新编译。
|
||||||
|
|
||||||
|
## 注意事项
|
||||||
|
|
||||||
|
### UI 设计规范(强制)
|
||||||
|
|
||||||
|
- **必须使用最新 UI 规范**:不管是新增页面、覆盖旧页面还是修改旧页面,都必须完全采用最新典型参考页面的 UI 设计规范
|
||||||
|
- **页面背景色**:根容器必须使用 `@color/color_f2`(`#F2F2F2`),禁止使用旧的白色或其他背景
|
||||||
|
- **搜索按钮**:使用 `@drawable/img_search` 图标(36x36dp + padding 2dp),不使用旧的 `iv_search_action` style
|
||||||
|
- **底部栏**:高度 50dp,文字 18sp bold,根据截图选择深蓝色(`@color/color_bottom_layout` + 白字)或白色(`@color/white` + `@color/bottom_tool_tips_text_color`)
|
||||||
|
- **详情页/表单页**:必须使用 **PadDataLayoutNew**(非旧版 PadDataLayout),卡片用 `bg_white_radius_8`
|
||||||
|
- **严格匹配典型页面**:在写开发计划前,必须先读取最新典型参考页面(如航班查询列表、日志查询页等),总结并列出 UI 设计规范要点
|
||||||
|
|
||||||
|
### 通用规则
|
||||||
|
|
||||||
|
- **资源引用必须存在**:使用 drawable/color/mipmap 前确认资源存在,不存在则换用已有资源
|
||||||
|
- **import 路径查阅 CLAUDE.md**:基类和扩展函数的正确 import 路径参见开发指南的 Import 速查表
|
||||||
|
- **不创建不需要的文件**:如果截图中没有 Dialog 弹窗,不要创建 Dialog 文件
|
||||||
|
- **Bean 复用优先**:如果现有 Bean 的字段足以覆盖截图需求,直接复用
|
||||||
|
- **API 接口对接**:页面创建完成后,通过空港集团 API 文档 MCP 查找真实接口并替换占位路径。遵循 API 搜索原则,按业务模块目录查找,不跨模块混用
|
||||||
|
- **DataBinding 规则**:遵循 CLAUDE.md 中的 DataBinding 关键规则(双向绑定、字符串拼接、View 导入等)
|
||||||
2
.gitignore
vendored
2
.gitignore
vendored
@@ -113,7 +113,7 @@ captures/
|
|||||||
*.swp
|
*.swp
|
||||||
|
|
||||||
# Keystore files
|
# Keystore files
|
||||||
*.jks
|
# *.jks
|
||||||
*.keystore
|
*.keystore
|
||||||
|
|
||||||
# Google Services (e.g. APIs or Firebase)
|
# Google Services (e.g. APIs or Firebase)
|
||||||
|
|||||||
14
.mcp.json
14
.mcp.json
@@ -1,14 +1,10 @@
|
|||||||
{
|
{
|
||||||
"mcpServers": {
|
"mcpServers": {
|
||||||
"apifox": {
|
"api-doc": {
|
||||||
"command": "npx",
|
"type": "http",
|
||||||
"args": [
|
"url": "https://www.agentfoxapp.com/mcp/976caff7-5f98-4487-bccf-3aa20c92cf1f",
|
||||||
"-y",
|
"headers": {
|
||||||
"apifox-mcp-server@latest",
|
"Authorization": "Bearer afk_G_VKmHTdXUi3GjQdg5AeHeH-0BSYQEPP"
|
||||||
"--project-id=7382863"
|
|
||||||
],
|
|
||||||
"env": {
|
|
||||||
"APIFOX_ACCESS_TOKEN": "APS-S2aVVwqasbdByzPLgSqryRC8BB0ZFqhQ"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
192
CLAUDE.md
192
CLAUDE.md
@@ -687,6 +687,8 @@ fun resetClick() {
|
|||||||
|
|
||||||
基于 `BaseDialogModel`(XPopup 封装),支持 5 种弹窗类型。
|
基于 `BaseDialogModel`(XPopup 封装),支持 5 种弹窗类型。
|
||||||
|
|
||||||
|
> ⚠️ **强制规则**:所有二次确认弹框**必须**使用 `ConfirmDialogModel`(`com.lukouguoji.module_base.model.ConfirmDialogModel`),**禁止**使用系统 `AlertDialog`。
|
||||||
|
|
||||||
### 基础模板
|
### 基础模板
|
||||||
|
|
||||||
```kotlin
|
```kotlin
|
||||||
@@ -812,6 +814,25 @@ adb logcat | grep "com.lukouguoji.aerologic" # 日志
|
|||||||
|
|
||||||
`completeSpace="@{5}"` 设置 Key 文本宽度(以"一"字宽度为单位),用于 Key-Value 布局对齐。
|
`completeSpace="@{5}"` 设置 Key 文本宽度(以"一"字宽度为单位),用于 Key-Value 布局对齐。
|
||||||
|
|
||||||
|
### AutoQuery 自动查询(PadSearchLayout / PadDataLayoutNew)
|
||||||
|
|
||||||
|
两个组件均支持输入时自动联想查询,只需在 XML 添加属性,无需修改 Kotlin:
|
||||||
|
|
||||||
|
```xml
|
||||||
|
<PadSearchLayout
|
||||||
|
autoQueryEnabled="@{true}"
|
||||||
|
autoQueryUrl="@{`/IntExpSearch/queryWbNoList`}"
|
||||||
|
autoQueryParamKey="@{`wbNo`}"
|
||||||
|
autoQueryMinLength="@{4}"
|
||||||
|
autoQueryMaxLength="@{8}"
|
||||||
|
autoQueryTitle="@{`选择运单号`}"
|
||||||
|
... />
|
||||||
|
```
|
||||||
|
|
||||||
|
- 1条结果 → 直接填充;多条结果 → 弹出选择列表;0条结果 → 无处理
|
||||||
|
- 通用 API 方法:`Api.getWbNoList(@Url url, @Body data)` 返回 `BaseResultBean<List<String>>`
|
||||||
|
- 关键文件:`module_base/.../ui/weight/data/layout/AutoQueryManager.kt`
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## Import 路径速查
|
## Import 路径速查
|
||||||
@@ -838,7 +859,20 @@ adb logcat | grep "com.lukouguoji.aerologic" # 日志
|
|||||||
|
|
||||||
### 扩展函数(均在 `com.lukouguoji.module_base.ktx` 包下)
|
### 扩展函数(均在 `com.lukouguoji.module_base.ktx` 包下)
|
||||||
|
|
||||||
`launchCollect`、`launchLoadingCollect`、`showToast`、`toRequestBody`、`verifyNullOrEmpty`、`noNull`、`formatDate`
|
`launchCollect`、`launchLoadingCollect`、`showToast`、`toRequestBody`、`verifyNullOrEmpty`、`noNull`、`formatDate`、`setUpperCaseAlphanumericFilter`
|
||||||
|
|
||||||
|
### 工具类
|
||||||
|
|
||||||
|
| 类 | 正确路径 |
|
||||||
|
|----|----------|
|
||||||
|
| `DictUtils` | `com.lukouguoji.module_base.util.DictUtils` |
|
||||||
|
| `MediaUtil` | `com.lukouguoji.module_base.util.MediaUtil` |
|
||||||
|
| `UploadUtil` | `com.lukouguoji.module_base.util.UploadUtil` |
|
||||||
|
| `KeyValue` | `dev.utils.app.info.KeyValue` |
|
||||||
|
| `DateUtils` | `dev.utils.common.DateUtils` |
|
||||||
|
| `SharedPreferenceUtil` | `com.lukouguoji.module_base.db.perference.SharedPreferenceUtil` |
|
||||||
|
| `ScanModel` | `com.lukouguoji.module_base.model.ScanModel` |
|
||||||
|
| `ConfirmDialogModel` | `com.lukouguoji.module_base.model.ConfirmDialogModel` |
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -861,6 +895,59 @@ adb logcat | grep "com.lukouguoji.aerologic" # 日志
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
## 编辑表单下拉框(SPINNER)回填规范
|
||||||
|
|
||||||
|
编辑页面(DetailsPageType.Modify)中,下拉框需要根据已有数据自动选中对应项。**必须使用 `DictUtils` 的 `checkedValue` 参数**,禁止依赖组件自动匹配 value。
|
||||||
|
|
||||||
|
### 原理
|
||||||
|
|
||||||
|
`DictUtils` 的 `handleCallBack` 会将 `checkedValue` 匹配的 `KeyValue` 置于列表首位。`PadDataLayoutNew` 的 SPINNER 默认显示列表第 0 项,因此匹配项自动成为选中项,无需额外设置 selectedIndex。
|
||||||
|
|
||||||
|
### 标准做法(参考 `GjjManifestDetailsViewModel`、`GjjManifestAddViewModel`)
|
||||||
|
|
||||||
|
1. **字典加载必须在编辑数据加载之后**(不能放在 `init` 中),确保 `checkedValue` 可用
|
||||||
|
2. **编辑模式传入 `checkedValue`**,新增模式传 `null`
|
||||||
|
3. **编辑模式不预置空 `KeyValue("", "")`**(否则空项会占据首位,覆盖 checkedValue 排序)
|
||||||
|
|
||||||
|
```kotlin
|
||||||
|
fun initOnCreated(intent: Intent) {
|
||||||
|
// 1. 先解析页面类型和编辑数据
|
||||||
|
if (pageType.value == DetailsPageType.Modify) {
|
||||||
|
loadManifestFromBean(bean) // 设置 agent.value、specialCode.value 等
|
||||||
|
}
|
||||||
|
// 2. 再加载字典列表(此时 checkedValue 已可用)
|
||||||
|
loadDictLists()
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun loadDictLists() {
|
||||||
|
val isModify = pageType.value == DetailsPageType.Modify
|
||||||
|
|
||||||
|
DictUtils.getXxxList(
|
||||||
|
addAll = false,
|
||||||
|
checkedValue = if (isModify) field.value else null // 编辑模式传值,新增传 null
|
||||||
|
) {
|
||||||
|
xxxList.postValue(if (isModify) it else listOf(KeyValue("", "")) + it)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### checkedValue 取值规则
|
||||||
|
|
||||||
|
提交时用的哪个字段值,`checkedValue` 就传哪个。对照 `toKeyValue()` 的 `value` 字段确认匹配:
|
||||||
|
|
||||||
|
| DictUtils 方法 | KeyValue.value 来源 | checkedValue 示例 |
|
||||||
|
|---|---|---|
|
||||||
|
| 通用(`handleCallBack`) | `DictBean.code` | `manifest.agentCode`(如 "SFINT") |
|
||||||
|
| `getShouYunPackageTypeList` | `PackageBean.name` | `manifest.packageType`(如 "木框") |
|
||||||
|
|
||||||
|
### 禁止做法
|
||||||
|
|
||||||
|
- ❌ 在 `init` 中加载字典(编辑数据尚未可用,无法传 `checkedValue`)
|
||||||
|
- ❌ 依赖 `PadDataLayoutNew` 的 `value` 属性自动匹配列表(Spinner adapter 重建时 `onItemSelected` 回调会覆盖已有值)
|
||||||
|
- ❌ 编辑模式下在列表前添加 `KeyValue("", "")`(会干扰 `checkedValue` 置顶排序)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
## 开发检查清单
|
## 开发检查清单
|
||||||
|
|
||||||
### 新页面开发必做
|
### 新页面开发必做
|
||||||
@@ -903,6 +990,109 @@ companion object {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### API 接口目录对应规则
|
||||||
|
|
||||||
|
为某页面查找接口时,**必须按业务路径匹配对应 API 目录**,不能跨模块借用。
|
||||||
|
|
||||||
|
| API 前缀 | 所属模块 |
|
||||||
|
|----------|---------|
|
||||||
|
| `IntImpManiFest/` | 国际进港-进港舱单(增删改查) |
|
||||||
|
| `IntImpAirManifest/` | 国际进港-原始舱单(申报、补充信息等) |
|
||||||
|
|
||||||
|
不同前缀代表不同业务,即使功能语义相似(如"更新"),也不能混用。不确定时询问用户。
|
||||||
|
|
||||||
|
### 页面定位规则
|
||||||
|
|
||||||
|
修改代码前,必须确认目标文件是**首页菜单实际跳转到的 Activity/ViewModel**,而非同名旧版文件。同一业务有多个实现时,以首页菜单入口链路为准。
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 图片上传与展示规范
|
||||||
|
|
||||||
|
### 图片上传三字段规范
|
||||||
|
|
||||||
|
上传图片后提交表单时,**必须同时传 `pic`、`originalPic`、`picNumber` 三个字段**,缺一不可。
|
||||||
|
|
||||||
|
**`UploadUtil.upload()` 返回值**(注意:**与字面意思相反**):
|
||||||
|
- `data?.newName` — **原图**文件名(较大)
|
||||||
|
- `data?.zipFileName` — **缩略图/压缩图**文件名(较小)
|
||||||
|
|
||||||
|
**提交时字段映射**(参考事故签证 `AccidentVisaDetailsViewModel`、`IntImpAccidentVisaEditViewModel`):
|
||||||
|
|
||||||
|
```kotlin
|
||||||
|
// FileBean 字段含义(约定用途,与 UploadBean 字段名不一致):
|
||||||
|
// - FileBean.url 作缩略图标识(提交到 bean.pic)
|
||||||
|
// - FileBean.originalPic 作原图标识(提交到 bean.originalPic)
|
||||||
|
|
||||||
|
// 上传新图片(注意 UploadBean 字段名的误导性,按实际含义赋值)
|
||||||
|
val data = UploadUtil.upload(fileBean.path).data
|
||||||
|
fileBean.url = data?.zipFileName ?: "" // 缩略图
|
||||||
|
fileBean.originalPic = data?.newName ?: "" // 原图
|
||||||
|
|
||||||
|
// 提交时设置三个字段
|
||||||
|
bean.picNumber = list.size.toString()
|
||||||
|
bean.pic = list.joinToString(",") { MediaUtil.removeUrl(it.url) } // 缩略图
|
||||||
|
bean.originalPic = list.joinToString(",") { MediaUtil.removeUrl(it.originalPic) } // 原图
|
||||||
|
```
|
||||||
|
|
||||||
|
**常见错误**:
|
||||||
|
- ❌ 只传 `images` 或 `originalPic` 单个字段 — 接口不认或数据不完整
|
||||||
|
- ❌ 只取 `newName` 不取 `zipFileName` — 丢失缩略图/原图之一
|
||||||
|
- ❌ 按 `UploadBean` 字段字面含义赋值(`url = newName`)— 会导致 pic/originalPic 内容和字段语义颠倒(缩略图字段装原图、原图字段装缩略图)
|
||||||
|
- ❌ 用 `fileBean.path.startsWith("http")` 判断已上传 — 应该用 `fileBean.url.isNotEmpty()`
|
||||||
|
|
||||||
|
### 编辑页加载已有图片
|
||||||
|
|
||||||
|
从详情接口获取图片后,需要同时解析 `pic`(缩略图)和 `originalPic`(原图),构建完整的 `FileBean`:
|
||||||
|
|
||||||
|
```kotlin
|
||||||
|
val picList = bean.pic.split(",").filter { it.isNotEmpty() }
|
||||||
|
val originalPicList = bean.originalPic.split(",").filter { it.isNotEmpty() }
|
||||||
|
val images = picList.mapIndexed { index, picUrl ->
|
||||||
|
val originalFile = originalPicList.getOrElse(index) { picUrl }
|
||||||
|
FileBean(
|
||||||
|
path = MediaUtil.fillUrl(picUrl), // 完整URL,用于显示
|
||||||
|
url = picUrl, // 相对路径,提交时用
|
||||||
|
originalPic = MediaUtil.fillUrl(originalFile) // 原图完整URL
|
||||||
|
)
|
||||||
|
}.toMutableList()
|
||||||
|
```
|
||||||
|
|
||||||
|
### 图片加载必须带 Authorization Header
|
||||||
|
|
||||||
|
`/file/getImg/` 接口需要鉴权,Glide 默认不带 token,直接用 `loadImage` BindingAdapter 会 **403 Forbidden**。
|
||||||
|
|
||||||
|
**正确做法** — 在 ViewHolder 中使用 `GlideUrl` + `LazyHeaders`:
|
||||||
|
|
||||||
|
```kotlin
|
||||||
|
// 缩略图加载(ViewHolder 中)
|
||||||
|
val glideUrl = GlideUrl(
|
||||||
|
bean.path,
|
||||||
|
LazyHeaders.Builder()
|
||||||
|
.addHeader("Authorization", SharedPreferenceUtil.getString(Constant.Share.token))
|
||||||
|
.build()
|
||||||
|
)
|
||||||
|
Glide.with(itemView.context).load(glideUrl).into(binding.ivThumbnail)
|
||||||
|
```
|
||||||
|
|
||||||
|
**同时必须去掉 XML 布局中的 `loadImage` 属性**,否则 BindingAdapter 会触发不带 token 的请求覆盖手动加载:
|
||||||
|
|
||||||
|
```xml
|
||||||
|
<!-- ❌ 错误:会触发不带 token 的 Glide 请求 -->
|
||||||
|
<ImageView loadImage="@{bean.path}" />
|
||||||
|
|
||||||
|
<!-- ✅ 正确:只保留 id,由 ViewHolder 手动加载 -->
|
||||||
|
<ImageView android:id="@+id/iv_thumbnail" />
|
||||||
|
```
|
||||||
|
|
||||||
|
**大图预览同理** — `PreviewImageViewHolder` 也需要用 `GlideUrl` 带 token 加载网络图片。
|
||||||
|
|
||||||
|
**参考文件**:
|
||||||
|
- 缩略图加载: `module_gjj/.../GjjManifestPicViewHolder.kt`
|
||||||
|
- 大图预览: `module_base/.../PreviewImageViewHolder.kt`
|
||||||
|
- 图片上传提交: `app/.../AccidentVisaDetailsViewModel.kt`
|
||||||
|
- 带 token 的 Glide 加载: `module_mit/.../PictureAdapter.kt`
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## 开发原则
|
## 开发原则
|
||||||
|
|||||||
@@ -75,23 +75,18 @@ class AccidentVisaDetailsViewModel : BaseViewModel(), IOnItemClickListener {
|
|||||||
onSuccess = {
|
onSuccess = {
|
||||||
dataBean.value = it.data ?: AccidentVisaBean()
|
dataBean.value = it.data ?: AccidentVisaBean()
|
||||||
|
|
||||||
// 渲染图片
|
// 渲染图片:pic 存缩略图文件名,originalPic 存原图文件名
|
||||||
val list = dataBean.value!!.pic.split(",")
|
val picList = dataBean.value!!.pic.split(",").filter { it.isNotEmpty() }
|
||||||
.filter { url -> url.isNotEmpty() }
|
val originalPicList = dataBean.value!!.originalPic.split(",").filter { it.isNotEmpty() }
|
||||||
.map { url ->
|
val list = picList.mapIndexed { index, picFilename ->
|
||||||
FileBean(MediaUtil.fillUrl(url), url)
|
val originalFilename = originalPicList.getOrElse(index) { picFilename }
|
||||||
}
|
FileBean(
|
||||||
val zipList = dataBean.value!!.originalPic.split(",")
|
path = MediaUtil.fillUrl(picFilename),
|
||||||
.filter { url -> url.isNotEmpty() }
|
url = picFilename,
|
||||||
.map { url ->
|
originalPic = MediaUtil.fillUrl(originalFilename)
|
||||||
FileBean(MediaUtil.fillUrl(url))
|
)
|
||||||
}
|
|
||||||
for ((index, fileBean) in list.withIndex()) {
|
|
||||||
val originalPic = zipList.get(index).path
|
|
||||||
list.get(index).originalPic = originalPic
|
|
||||||
}
|
}
|
||||||
rv?.commonAdapter()
|
rv?.commonAdapter()?.loadMore(list)
|
||||||
?.loadMore(list)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -110,8 +105,10 @@ class AccidentVisaDetailsViewModel : BaseViewModel(), IOnItemClickListener {
|
|||||||
.filter { it.path.isNotEmpty() && it.url.isEmpty() }
|
.filter { it.path.isNotEmpty() && it.url.isEmpty() }
|
||||||
.onEach {
|
.onEach {
|
||||||
val data = UploadUtil.upload(it.path).data
|
val data = UploadUtil.upload(it.path).data
|
||||||
it.url = data?.newName ?: ""
|
// UploadUtil 返回:newName=原图(较大),zipFileName=缩略图(较小)
|
||||||
it.originalPic = data?.zipFileName ?: ""
|
// FileBean.url 用作缩略图标识,FileBean.originalPic 用作原图标识
|
||||||
|
it.url = data?.zipFileName ?: ""
|
||||||
|
it.originalPic = data?.newName ?: ""
|
||||||
}
|
}
|
||||||
.flowOn(Dispatchers.IO)
|
.flowOn(Dispatchers.IO)
|
||||||
.onStart { showLoading() }
|
.onStart { showLoading() }
|
||||||
@@ -124,8 +121,8 @@ class AccidentVisaDetailsViewModel : BaseViewModel(), IOnItemClickListener {
|
|||||||
val list =
|
val list =
|
||||||
(rv?.commonAdapter()?.items as List<FileBean>).filter { it.path.isNotEmpty() }
|
(rv?.commonAdapter()?.items as List<FileBean>).filter { it.path.isNotEmpty() }
|
||||||
bean.picnumber = list.size.toString()
|
bean.picnumber = list.size.toString()
|
||||||
bean.originalPic = list.joinToString(separator = ",") { MediaUtil.removeUrl(it.url) }
|
bean.pic = list.joinToString(separator = ",") { MediaUtil.removeUrl(it.url) }
|
||||||
bean.pic = list.joinToString(separator = ",") { MediaUtil.removeUrl(it.originalPic) }
|
bean.originalPic = list.joinToString(separator = ",") { MediaUtil.removeUrl(it.originalPic) }
|
||||||
|
|
||||||
NetApply.api.anyPost(
|
NetApply.api.anyPost(
|
||||||
url = if (pageType.value == DetailsPageType.Add) "GnAccidentVisa/saveVisa" else "GnAccidentVisa/updateVisa",
|
url = if (pageType.value == DetailsPageType.Add) "GnAccidentVisa/saveVisa" else "GnAccidentVisa/updateVisa",
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package com.lukouguoji.aerologic.page.gnj.move.stash.list
|
package com.lukouguoji.aerologic.page.gnj.move.stash.list
|
||||||
|
|
||||||
import android.view.View
|
import android.view.View
|
||||||
|
import android.widget.Toast
|
||||||
import com.lukouguoji.aerologic.databinding.ItemGnjMoveStashListBinding
|
import com.lukouguoji.aerologic.databinding.ItemGnjMoveStashListBinding
|
||||||
import com.lukouguoji.gnj.page.yiku.handover.GnjYiKuHandoverActivity
|
import com.lukouguoji.gnj.page.yiku.handover.GnjYiKuHandoverActivity
|
||||||
import com.lukouguoji.module_base.base.BaseViewHolder
|
import com.lukouguoji.module_base.base.BaseViewHolder
|
||||||
@@ -25,6 +26,10 @@ class GnjMoveStashListViewHolder(view: View) :
|
|||||||
// 侧滑菜单 - 编辑按钮
|
// 侧滑菜单 - 编辑按钮
|
||||||
binding.btnEdit.setOnClickListener {
|
binding.btnEdit.setOnClickListener {
|
||||||
binding.swipeMenu.quickClose()
|
binding.swipeMenu.quickClose()
|
||||||
|
if (bean.pickFlag == "1") {
|
||||||
|
Toast.makeText(itemView.context, "已出库,不可编辑", Toast.LENGTH_SHORT).show()
|
||||||
|
return@setOnClickListener
|
||||||
|
}
|
||||||
GnjYiKuHandoverActivity.startForEdit(itemView.context, bean.mawbId)
|
GnjYiKuHandoverActivity.startForEdit(itemView.context, bean.mawbId)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -44,7 +44,8 @@ class LogDetailActivity : BaseBindingActivity<ActivityLogDetailBinding, LogDetai
|
|||||||
viewModel.latestStepCode.observe(this) { rebuildSteps() }
|
viewModel.latestStepCode.observe(this) { rebuildSteps() }
|
||||||
|
|
||||||
viewModel.statusLogList.observe(this) { list ->
|
viewModel.statusLogList.observe(this) { list ->
|
||||||
timelineAdapter.setData(list)
|
val stepMap = viewModel.allSteps.value?.associate { it.code to it.name } ?: emptyMap()
|
||||||
|
timelineAdapter.setData(list, stepMap)
|
||||||
}
|
}
|
||||||
|
|
||||||
viewModel.initOnCreated(intent)
|
viewModel.initOnCreated(intent)
|
||||||
|
|||||||
@@ -11,9 +11,11 @@ import com.lukouguoji.module_base.bean.StatusLogBean
|
|||||||
class LogDetailTimelineAdapter : RecyclerView.Adapter<LogDetailTimelineAdapter.TimelineViewHolder>() {
|
class LogDetailTimelineAdapter : RecyclerView.Adapter<LogDetailTimelineAdapter.TimelineViewHolder>() {
|
||||||
|
|
||||||
private var items: List<StatusLogBean> = emptyList()
|
private var items: List<StatusLogBean> = emptyList()
|
||||||
|
private var statusNameMap: Map<String, String> = emptyMap()
|
||||||
|
|
||||||
fun setData(list: List<StatusLogBean>) {
|
fun setData(list: List<StatusLogBean>, stepMap: Map<String, String> = emptyMap()) {
|
||||||
items = list
|
items = list
|
||||||
|
statusNameMap = stepMap
|
||||||
notifyDataSetChanged()
|
notifyDataSetChanged()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -28,8 +30,9 @@ class LogDetailTimelineAdapter : RecyclerView.Adapter<LogDetailTimelineAdapter.T
|
|||||||
val isFirst = position == 0
|
val isFirst = position == 0
|
||||||
val isLast = position == items.size - 1
|
val isLast = position == items.size - 1
|
||||||
|
|
||||||
holder.tvContent.text = item.content
|
val statusName = statusNameMap[item.status] ?: item.status
|
||||||
holder.tvTime.text = item.opDate
|
holder.tvContent.text = if (statusName.isNotEmpty()) "$statusName ${item.opDate}" else item.opDate
|
||||||
|
holder.tvTime.text = item.content
|
||||||
|
|
||||||
// 最后一项(当前步骤)用绿色圆点
|
// 最后一项(当前步骤)用绿色圆点
|
||||||
holder.dotView.setBackgroundResource(
|
holder.dotView.setBackgroundResource(
|
||||||
|
|||||||
@@ -37,6 +37,7 @@ import com.lukouguoji.gnc.page.deposit.list.GncDepositListActivity
|
|||||||
import com.lukouguoji.gnc.page.distribution.home.GncDistributionHomeActivity
|
import com.lukouguoji.gnc.page.distribution.home.GncDistributionHomeActivity
|
||||||
import com.lukouguoji.gnc.page.fubang.list.GncFuBangListActivity
|
import com.lukouguoji.gnc.page.fubang.list.GncFuBangListActivity
|
||||||
import com.lukouguoji.gnc.page.shouyun.unlist.GncShouYunUnListActivity
|
import com.lukouguoji.gnc.page.shouyun.unlist.GncShouYunUnListActivity
|
||||||
|
import com.lukouguoji.gnj.activity.GnjChuKuListActivity
|
||||||
import com.lukouguoji.module_base.MyApplication
|
import com.lukouguoji.module_base.MyApplication
|
||||||
import com.lukouguoji.module_base.common.Constant
|
import com.lukouguoji.module_base.common.Constant
|
||||||
import com.lukouguoji.module_base.db.perference.SharedPreferenceUtil
|
import com.lukouguoji.module_base.db.perference.SharedPreferenceUtil
|
||||||
@@ -314,7 +315,8 @@ class HomeFragment : Fragment() {
|
|||||||
}
|
}
|
||||||
//出库
|
//出库
|
||||||
Constant.AuthName.GnjChuKuList -> {
|
Constant.AuthName.GnjChuKuList -> {
|
||||||
GnjMoveStashListActivity.start(requireContext())
|
ARouter.getInstance().build(ARouterConstants.ACTIVITY_URL_GNJ_CHU_KU_LIST)
|
||||||
|
.navigation()
|
||||||
}
|
}
|
||||||
//仓库管理
|
//仓库管理
|
||||||
Constant.AuthName.GnjWareHouse -> {
|
Constant.AuthName.GnjWareHouse -> {
|
||||||
|
|||||||
@@ -76,7 +76,7 @@
|
|||||||
<androidx.appcompat.widget.LinearLayoutCompat
|
<androidx.appcompat.widget.LinearLayoutCompat
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="1"
|
android:layout_weight="0.8"
|
||||||
android:gravity="center_vertical">
|
android:gravity="center_vertical">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
@@ -95,7 +95,7 @@
|
|||||||
<androidx.appcompat.widget.LinearLayoutCompat
|
<androidx.appcompat.widget.LinearLayoutCompat
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="1"
|
android:layout_weight="0.7"
|
||||||
android:gravity="center_vertical">
|
android:gravity="center_vertical">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
@@ -114,7 +114,7 @@
|
|||||||
<androidx.appcompat.widget.LinearLayoutCompat
|
<androidx.appcompat.widget.LinearLayoutCompat
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="1"
|
android:layout_weight="0.8"
|
||||||
android:gravity="center_vertical">
|
android:gravity="center_vertical">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
@@ -178,7 +178,7 @@
|
|||||||
<androidx.appcompat.widget.LinearLayoutCompat
|
<androidx.appcompat.widget.LinearLayoutCompat
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="1"
|
android:layout_weight="0.8"
|
||||||
android:gravity="center_vertical">
|
android:gravity="center_vertical">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
@@ -197,7 +197,7 @@
|
|||||||
<androidx.appcompat.widget.LinearLayoutCompat
|
<androidx.appcompat.widget.LinearLayoutCompat
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="1"
|
android:layout_weight="0.8"
|
||||||
android:gravity="center_vertical">
|
android:gravity="center_vertical">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
@@ -216,7 +216,7 @@
|
|||||||
<androidx.appcompat.widget.LinearLayoutCompat
|
<androidx.appcompat.widget.LinearLayoutCompat
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="1"
|
android:layout_weight="0.8"
|
||||||
android:gravity="center_vertical">
|
android:gravity="center_vertical">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
@@ -255,6 +255,14 @@
|
|||||||
|
|
||||||
</LinearLayout>
|
</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>
|
</androidx.appcompat.widget.LinearLayoutCompat>
|
||||||
|
|
||||||
<!-- 侧滑菜单区域 -->
|
<!-- 侧滑菜单区域 -->
|
||||||
|
|||||||
@@ -12,12 +12,16 @@ import androidx.fragment.app.Fragment
|
|||||||
import androidx.recyclerview.widget.RecyclerView
|
import androidx.recyclerview.widget.RecyclerView
|
||||||
import com.bumptech.glide.Glide
|
import com.bumptech.glide.Glide
|
||||||
import com.bumptech.glide.load.engine.DiskCacheStrategy
|
import com.bumptech.glide.load.engine.DiskCacheStrategy
|
||||||
|
import com.bumptech.glide.load.model.GlideUrl
|
||||||
|
import com.bumptech.glide.load.model.LazyHeaders
|
||||||
import com.bumptech.glide.load.resource.bitmap.CenterCrop
|
import com.bumptech.glide.load.resource.bitmap.CenterCrop
|
||||||
import com.bumptech.glide.load.resource.bitmap.GranularRoundedCorners
|
import com.bumptech.glide.load.resource.bitmap.GranularRoundedCorners
|
||||||
import com.bumptech.glide.load.resource.bitmap.RoundedCorners
|
import com.bumptech.glide.load.resource.bitmap.RoundedCorners
|
||||||
import com.bumptech.glide.request.RequestOptions
|
import com.bumptech.glide.request.RequestOptions
|
||||||
import com.lukouguoji.module_base.base.BaseViewHolder
|
import com.lukouguoji.module_base.base.BaseViewHolder
|
||||||
import com.lukouguoji.module_base.base.CommonAdapter
|
import com.lukouguoji.module_base.base.CommonAdapter
|
||||||
|
import com.lukouguoji.module_base.common.Constant
|
||||||
|
import com.lukouguoji.module_base.db.perference.SharedPreferenceUtil
|
||||||
import com.lukouguoji.module_base.ktx.loge
|
import com.lukouguoji.module_base.ktx.loge
|
||||||
import com.lukouguoji.module_base.util.SizeUtils
|
import com.lukouguoji.module_base.util.SizeUtils
|
||||||
|
|
||||||
@@ -111,10 +115,22 @@ fun loadImage(
|
|||||||
com.bumptech.glide.request.target.Target.SIZE_ORIGINAL
|
com.bumptech.glide.request.target.Target.SIZE_ORIGINAL
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// 对 http(s) 字符串 URL,自动包装为带 Authorization header 的 GlideUrl,避免 /file/getImg/ 接口 403
|
||||||
|
val actualSource: Any? = if (source is String && (source.startsWith("http://") || source.startsWith("https://"))) {
|
||||||
|
GlideUrl(
|
||||||
|
source,
|
||||||
|
LazyHeaders.Builder()
|
||||||
|
.addHeader("Authorization", SharedPreferenceUtil.getString(Constant.Share.token))
|
||||||
|
.build()
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
source
|
||||||
|
}
|
||||||
|
|
||||||
// 设置图片加载
|
// 设置图片加载
|
||||||
val load = Glide.with(imageView)
|
val load = Glide.with(imageView)
|
||||||
.setDefaultRequestOptions(requestOptions)
|
.setDefaultRequestOptions(requestOptions)
|
||||||
.load(source)
|
.load(actualSource)
|
||||||
.diskCacheStrategy(diskCacheStrategy)
|
.diskCacheStrategy(diskCacheStrategy)
|
||||||
.encodeFormat(encodeFormat)
|
.encodeFormat(encodeFormat)
|
||||||
|
|
||||||
|
|||||||
@@ -29,7 +29,8 @@ data class GjjHaWb(
|
|||||||
var opDate: String = "",
|
var opDate: String = "",
|
||||||
var billsNo: String = "",
|
var billsNo: String = "",
|
||||||
var remark: String = "",
|
var remark: String = "",
|
||||||
var response: String = ""
|
var response: String = "",
|
||||||
|
var tallyStatus: String = ""
|
||||||
) : Serializable {
|
) : Serializable {
|
||||||
@Transient
|
@Transient
|
||||||
val checked: ObservableBoolean = ObservableBoolean(false)
|
val checked: ObservableBoolean = ObservableBoolean(false)
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ data class GjjImportManifest(
|
|||||||
// 目的地
|
// 目的地
|
||||||
var dest: String = "",
|
var dest: String = "",
|
||||||
// 危险品收货人通讯方式
|
// 危险品收货人通讯方式
|
||||||
var dgrContactMame: String = "",
|
var dgrContactName: String = "",
|
||||||
// 危险品收货人通讯方式
|
// 危险品收货人通讯方式
|
||||||
var dgrContactNumber: String = "",
|
var dgrContactNumber: String = "",
|
||||||
// 航班日期
|
// 航班日期
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ data class GjjManifest(
|
|||||||
var awbType: String = "", // 运单类型
|
var awbType: String = "", // 运单类型
|
||||||
var awbTypeName: String = "", // 运单类型(中)
|
var awbTypeName: String = "", // 运单类型(中)
|
||||||
var businessType: String = "", // 业务类型
|
var businessType: String = "", // 业务类型
|
||||||
|
var businessName: String = "", // 业务类型名称
|
||||||
var cargoType: String = "", // 货物类型
|
var cargoType: String = "", // 货物类型
|
||||||
var spCode: String = "", // 特码
|
var spCode: String = "", // 特码
|
||||||
var packageType: String = "", // 包装类型
|
var packageType: String = "", // 包装类型
|
||||||
@@ -55,7 +56,10 @@ data class GjjManifest(
|
|||||||
var subCode: String = "", // 子代码
|
var subCode: String = "", // 子代码
|
||||||
var unNumber: String = "", // 危险品编号
|
var unNumber: String = "", // 危险品编号
|
||||||
var activeId: Long = 0, // 活动ID
|
var activeId: Long = 0, // 活动ID
|
||||||
var locationTally: String = "" // 理货库位号
|
var locationTally: String = "", // 理货库位号
|
||||||
|
var pic: String = "", // 交接图片缩略图路径
|
||||||
|
var originalPic: String = "", // 交接图片原图地址
|
||||||
|
var picNumber: String = "" // 交接图片数量
|
||||||
) : Serializable {
|
) : Serializable {
|
||||||
// 分单列表
|
// 分单列表
|
||||||
var haWbList: List<GjjHaWb>? = null
|
var haWbList: List<GjjHaWb>? = null
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ class GjjManifestBean(
|
|||||||
var awbType: String = "",
|
var awbType: String = "",
|
||||||
var awbpc: Int = 0,
|
var awbpc: Int = 0,
|
||||||
var businessType: String? = "",
|
var businessType: String? = "",
|
||||||
|
var businessName: String? = "",
|
||||||
var cargoType: String? = "",
|
var cargoType: String? = "",
|
||||||
var cashWeight: String? = "",
|
var cashWeight: String? = "",
|
||||||
var cneeCode: String? = "",
|
var cneeCode: String? = "",
|
||||||
@@ -73,7 +74,10 @@ class GjjManifestBean(
|
|||||||
var wbNo: String = "",
|
var wbNo: String = "",
|
||||||
var weight: String = "",
|
var weight: String = "",
|
||||||
var storageTime: String = "",
|
var storageTime: String = "",
|
||||||
var whslocation: String? = ""
|
var whslocation: String? = "",
|
||||||
|
var pic: String = "",
|
||||||
|
var originalPic: String = "",
|
||||||
|
var picNumber: String = ""
|
||||||
) : BaseObservable(), ICheck {
|
) : BaseObservable(), ICheck {
|
||||||
|
|
||||||
// 展示逻辑
|
// 展示逻辑
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ class GnjYiKuBean : ICheck {
|
|||||||
var businessType: String = "" // 业务类型
|
var businessType: String = "" // 业务类型
|
||||||
var opDate: String = "" // 操作日期
|
var opDate: String = "" // 操作日期
|
||||||
var carrier: String = "" // 承运人
|
var carrier: String = "" // 承运人
|
||||||
|
var pickFlag: String = "" // 出库标志(1=已出库)
|
||||||
|
|
||||||
// 多选状态绑定
|
// 多选状态绑定
|
||||||
val checked = ObservableBoolean(false)
|
val checked = ObservableBoolean(false)
|
||||||
|
|||||||
@@ -6,12 +6,12 @@ class IntImpAccidentVisaBean {
|
|||||||
var id: Long = 0
|
var id: Long = 0
|
||||||
var fdate: String = "" // 航班日期
|
var fdate: String = "" // 航班日期
|
||||||
var fno: String = "" // 航班号
|
var fno: String = "" // 航班号
|
||||||
var fdep: String = "" // 始发站
|
var dep: String = "" // 始发站
|
||||||
var fdest: String = "" // 目的站
|
var dest: String = "" // 目的站
|
||||||
var wbNo: String = "" // 运单号
|
var wbNo: String = "" // 运单号
|
||||||
var totalPc: Int = 0 // 运单总件数
|
var pc: Int = 0 // 运单总件数
|
||||||
var totalWeight: Double = 0.0 // 运单总重量
|
var weight: Double = 0.0 // 运单总重量
|
||||||
var abnPc: Int = 0 // 不正常件数
|
var dpc: Int = 0 // 不正常件数
|
||||||
var opId: String = "" // 经办人
|
var opId: String = "" // 经办人
|
||||||
var opdate: String = "" // 经办时间
|
var opdate: String = "" // 经办时间
|
||||||
|
|
||||||
|
|||||||
@@ -401,5 +401,8 @@ interface Constant {
|
|||||||
|
|
||||||
// 运单类型
|
// 运单类型
|
||||||
const val AWB_TYPE = "awbType"
|
const val AWB_TYPE = "awbType"
|
||||||
|
|
||||||
|
const val PIC = "pic"
|
||||||
|
const val ORIGINAL_PIC = "originalPic"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -308,6 +308,12 @@ interface Api {
|
|||||||
@POST("typeCode/countryCode")
|
@POST("typeCode/countryCode")
|
||||||
suspend fun getCountryCodeList(): DictListBean
|
suspend fun getCountryCodeList(): DictListBean
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取国家代码(带始发站筛选)
|
||||||
|
*/
|
||||||
|
@POST("typeCode/countryCode")
|
||||||
|
suspend fun getCountryCodeListByFdep(@Query("fDep") fDep: String): DictListBean
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取通讯方式类型
|
* 获取通讯方式类型
|
||||||
*/
|
*/
|
||||||
@@ -957,7 +963,7 @@ interface Api {
|
|||||||
* 接口路径: /IntImpStorage/inStorage
|
* 接口路径: /IntImpStorage/inStorage
|
||||||
*/
|
*/
|
||||||
@POST("IntImpStorage/inStorage")
|
@POST("IntImpStorage/inStorage")
|
||||||
suspend fun inIntImpStorage(@Query("location") location: String, @Body data: RequestBody): BaseResultBean<Boolean>
|
suspend fun inIntImpStorage(@Body data: RequestBody): BaseResultBean<Boolean>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 国际进港提取记录-分页查询
|
* 国际进港提取记录-分页查询
|
||||||
@@ -1280,6 +1286,18 @@ interface Api {
|
|||||||
@POST("IntImpManiFest/deleteFestList")
|
@POST("IntImpManiFest/deleteFestList")
|
||||||
suspend fun gjjManifestDeleteBatch(@Body data: RequestBody): BaseResultBean<Any>
|
suspend fun gjjManifestDeleteBatch(@Body data: RequestBody): BaseResultBean<Any>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除舱单(主单)- 请求体为 GjjManifest 对象数组
|
||||||
|
*/
|
||||||
|
@POST("IntImpManifest/deleteManifest")
|
||||||
|
suspend fun intImpManifestDeleteManifest(@Body data: RequestBody): BaseResultBean<Any>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除分单 - 请求体为 GjjHaWb 对象数组
|
||||||
|
*/
|
||||||
|
@POST("IntImpManifest/deleteHawb")
|
||||||
|
suspend fun intImpManifestDeleteHawb(@Body data: RequestBody): BaseResultBean<Any>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增-国际进港舱单
|
* 新增-国际进港舱单
|
||||||
*/
|
*/
|
||||||
@@ -1355,6 +1373,12 @@ interface Api {
|
|||||||
@POST("flt/queryFlight")
|
@POST("flt/queryFlight")
|
||||||
suspend fun queryFlightByDateAndNo(@Body data: RequestBody): BaseResultBean<FlightBean>
|
suspend fun queryFlightByDateAndNo(@Body data: RequestBody): BaseResultBean<FlightBean>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据航班日期、航班号、地区类型、进出港查询航班(返回列表)
|
||||||
|
*/
|
||||||
|
@POST("flt/searchFlightList")
|
||||||
|
suspend fun searchFlightList(@Body data: RequestBody): BaseResultBean<List<FlightBean>>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取航班目的站、经停站
|
* 获取航班目的站、经停站
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -1,17 +1,19 @@
|
|||||||
package com.lukouguoji.module_base.impl
|
package com.lukouguoji.module_base.impl
|
||||||
|
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import com.luck.picture.lib.adapter.holder.PreviewImageHolder
|
import com.bumptech.glide.Glide
|
||||||
import com.luck.picture.lib.basic.PictureSelector
|
import com.bumptech.glide.load.model.GlideUrl
|
||||||
import com.lukouguoji.module_base.adapter.loadImage
|
import com.bumptech.glide.load.model.LazyHeaders
|
||||||
import com.lukouguoji.module_base.base.BaseViewHolder
|
import com.lukouguoji.module_base.base.BaseViewHolder
|
||||||
import com.lukouguoji.module_base.bean.FileBean
|
import com.lukouguoji.module_base.bean.FileBean
|
||||||
|
import com.lukouguoji.module_base.common.Constant
|
||||||
import com.lukouguoji.module_base.databinding.ItemImageSelectBinding
|
import com.lukouguoji.module_base.databinding.ItemImageSelectBinding
|
||||||
|
import com.lukouguoji.module_base.db.perference.SharedPreferenceUtil
|
||||||
import com.lukouguoji.module_base.ktx.commonAdapter
|
import com.lukouguoji.module_base.ktx.commonAdapter
|
||||||
import com.lukouguoji.module_base.ktx.logd
|
import com.lukouguoji.module_base.ktx.logd
|
||||||
import com.lukouguoji.module_base.ktx.loge
|
|
||||||
import com.lukouguoji.module_base.ui.page.preview.PreviewActivity
|
import com.lukouguoji.module_base.ui.page.preview.PreviewActivity
|
||||||
import com.lukouguoji.module_base.util.MediaUtil
|
import com.lukouguoji.module_base.util.MediaUtil
|
||||||
|
import java.io.File
|
||||||
|
|
||||||
class ImageSelectViewHolder(view: View) : BaseViewHolder<FileBean, ItemImageSelectBinding>(view) {
|
class ImageSelectViewHolder(view: View) : BaseViewHolder<FileBean, ItemImageSelectBinding>(view) {
|
||||||
|
|
||||||
@@ -19,6 +21,21 @@ class ImageSelectViewHolder(view: View) : BaseViewHolder<FileBean, ItemImageSele
|
|||||||
val bean = getItemBean(item)!!
|
val bean = getItemBean(item)!!
|
||||||
binding.bean = bean
|
binding.bean = bean
|
||||||
|
|
||||||
|
// 加载缩略图
|
||||||
|
if (bean.path.isNotEmpty()) {
|
||||||
|
if (bean.isOnlineResource()) {
|
||||||
|
val glideUrl = GlideUrl(
|
||||||
|
bean.path,
|
||||||
|
LazyHeaders.Builder()
|
||||||
|
.addHeader("Authorization", SharedPreferenceUtil.getString(Constant.Share.token))
|
||||||
|
.build()
|
||||||
|
)
|
||||||
|
Glide.with(itemView.context).load(glideUrl).into(binding.iv)
|
||||||
|
} else {
|
||||||
|
Glide.with(itemView.context).load(File(bean.path)).into(binding.iv)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
binding.rl.setOnClickListener {
|
binding.rl.setOnClickListener {
|
||||||
if (bean.path.isEmpty()) {
|
if (bean.path.isEmpty()) {
|
||||||
MediaUtil.pickImage(itemView.context, maxNum = 10) {
|
MediaUtil.pickImage(itemView.context, maxNum = 10) {
|
||||||
@@ -28,7 +45,15 @@ class ImageSelectViewHolder(view: View) : BaseViewHolder<FileBean, ItemImageSele
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
PreviewActivity.start(itemView.context, listOf(bean))
|
val items = getRecyclerView()?.commonAdapter()?.items
|
||||||
|
?.filterIsInstance<FileBean>()
|
||||||
|
?.filter { it.path.isNotEmpty() }
|
||||||
|
?: listOf(bean)
|
||||||
|
val previewList = items.map { fb ->
|
||||||
|
FileBean(path = if (fb.originalPic.isNotEmpty()) fb.originalPic else fb.path)
|
||||||
|
}
|
||||||
|
val previewPosition = items.indexOfFirst { it === bean }.coerceAtLeast(0)
|
||||||
|
PreviewActivity.start(itemView.context, previewList, previewPosition)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -39,13 +64,6 @@ class ImageSelectViewHolder(view: View) : BaseViewHolder<FileBean, ItemImageSele
|
|||||||
}
|
}
|
||||||
|
|
||||||
notifyItemClick(position, binding.ivDelete)
|
notifyItemClick(position, binding.ivDelete)
|
||||||
|
|
||||||
if (bean.isOnlineResource()) {
|
|
||||||
loge("开始下载 : ${bean.path}")
|
|
||||||
bean.download {
|
|
||||||
loadImage(binding.iv, it)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1,9 +1,14 @@
|
|||||||
package com.lukouguoji.module_base.ui.page.preview
|
package com.lukouguoji.module_base.ui.page.preview
|
||||||
|
|
||||||
import android.view.View
|
import android.view.View
|
||||||
|
import com.bumptech.glide.Glide
|
||||||
|
import com.bumptech.glide.load.model.GlideUrl
|
||||||
|
import com.bumptech.glide.load.model.LazyHeaders
|
||||||
import com.lukouguoji.module_base.base.BaseViewHolder
|
import com.lukouguoji.module_base.base.BaseViewHolder
|
||||||
import com.lukouguoji.module_base.bean.FileBean
|
import com.lukouguoji.module_base.bean.FileBean
|
||||||
|
import com.lukouguoji.module_base.common.Constant
|
||||||
import com.lukouguoji.module_base.databinding.ItemPreviewImageBinding
|
import com.lukouguoji.module_base.databinding.ItemPreviewImageBinding
|
||||||
|
import com.lukouguoji.module_base.db.perference.SharedPreferenceUtil
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author:孟凡华
|
* @author:孟凡华
|
||||||
@@ -14,8 +19,26 @@ class PreviewImageViewHolder(view: View) :
|
|||||||
BaseViewHolder<FileBean, ItemPreviewImageBinding>(view) {
|
BaseViewHolder<FileBean, ItemPreviewImageBinding>(view) {
|
||||||
|
|
||||||
override fun onBind(item: Any?, position: Int) {
|
override fun onBind(item: Any?, position: Int) {
|
||||||
binding.bean = getItemBean(item)
|
val bean = getItemBean(item) ?: return
|
||||||
|
binding.bean = bean
|
||||||
|
|
||||||
|
// 加载图片
|
||||||
|
val path = bean.path
|
||||||
|
if (path.isNotEmpty()) {
|
||||||
|
if (path.startsWith("http")) {
|
||||||
|
// 网络图片带 Authorization header
|
||||||
|
val glideUrl = GlideUrl(
|
||||||
|
path,
|
||||||
|
LazyHeaders.Builder()
|
||||||
|
.addHeader("Authorization", SharedPreferenceUtil.getString(Constant.Share.token))
|
||||||
|
.build()
|
||||||
|
)
|
||||||
|
Glide.with(itemView.context).load(glideUrl).into(binding.photoView)
|
||||||
|
} else {
|
||||||
|
// 本地图片直接加载
|
||||||
|
Glide.with(itemView.context).load(path).into(binding.photoView)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -97,7 +97,7 @@ class PadDataLayoutNew : FrameLayout {
|
|||||||
|
|
||||||
et.hint = value
|
et.hint = value
|
||||||
tv.hint = value
|
tv.hint = value
|
||||||
bindAdapter(spinner, list, hint)
|
updateSpinnerSilently { bindAdapter(spinner, list, hint) }
|
||||||
}
|
}
|
||||||
|
|
||||||
var required = false
|
var required = false
|
||||||
@@ -106,11 +106,29 @@ class PadDataLayoutNew : FrameLayout {
|
|||||||
tvM.visibility = if (value) VISIBLE else INVISIBLE
|
tvM.visibility = if (value) VISIBLE else INVISIBLE
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private val spinnerCallback = object : IOnSpinnerSelected {
|
||||||
|
override fun onSelected(position: Int) {
|
||||||
|
value = list.getOrNull(position)?.value ?: ""
|
||||||
|
refreshCallBack?.invoke()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private val restoreListenerRunnable = Runnable {
|
||||||
|
bindOnSelected(spinner, spinnerCallback)
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun updateSpinnerSilently(block: () -> Unit) {
|
||||||
|
spinner.onItemSelectedListener = null
|
||||||
|
spinner.removeCallbacks(restoreListenerRunnable)
|
||||||
|
block()
|
||||||
|
onValueSet()
|
||||||
|
spinner.post(restoreListenerRunnable)
|
||||||
|
}
|
||||||
|
|
||||||
var list = emptyList<KeyValue>()
|
var list = emptyList<KeyValue>()
|
||||||
set(value) {
|
set(value) {
|
||||||
field = value
|
field = value
|
||||||
bindAdapter(spinner, value, hint)
|
updateSpinnerSilently { bindAdapter(spinner, value, hint) }
|
||||||
onValueSet()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var icon: Any? = null
|
var icon: Any? = null
|
||||||
@@ -183,12 +201,7 @@ class PadDataLayoutNew : FrameLayout {
|
|||||||
et.doOnTextChanged { text, _, _, _ ->
|
et.doOnTextChanged { text, _, _, _ ->
|
||||||
value = text.toString()
|
value = text.toString()
|
||||||
}
|
}
|
||||||
bindOnSelected(spinner, object : IOnSpinnerSelected {
|
bindOnSelected(spinner, spinnerCallback)
|
||||||
override fun onSelected(position: Int) {
|
|
||||||
value = list.getOrNull(position)?.value ?: ""
|
|
||||||
refreshCallBack?.invoke()
|
|
||||||
}
|
|
||||||
})
|
|
||||||
// 监听输入框焦点变化
|
// 监听输入框焦点变化
|
||||||
com.lukouguoji.module_base.adapter.setOnFocusChangeListener(
|
com.lukouguoji.module_base.adapter.setOnFocusChangeListener(
|
||||||
et, object : IOnFocusChangeListener {
|
et, object : IOnFocusChangeListener {
|
||||||
|
|||||||
@@ -24,7 +24,6 @@
|
|||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/iv"
|
android:id="@+id/iv"
|
||||||
loadImage="@{bean.path}"
|
|
||||||
visible="@{bean.path}"
|
visible="@{bean.path}"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="0dp"
|
android:layout_height="0dp"
|
||||||
android:layout_margin="5dp"
|
android:layout_margin="5dp"
|
||||||
android:background="@color/white">
|
android:background="@{bean.path.length() == 0 ? @color/color_f2 : @color/white}">
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
visible="@{bean.path.length() == 0}"
|
visible="@{bean.path.length() == 0}"
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
android:layout_height="match_parent">
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
<com.luck.picture.lib.photoview.PhotoView
|
<com.luck.picture.lib.photoview.PhotoView
|
||||||
loadImage="@{bean.path}"
|
android:id="@+id/photo_view"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent" />
|
android:layout_height="match_parent" />
|
||||||
|
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ import com.lukouguoji.module_base.util.Common
|
|||||||
import java.text.SimpleDateFormat
|
import java.text.SimpleDateFormat
|
||||||
import java.util.*
|
import java.util.*
|
||||||
|
|
||||||
|
@Deprecated("旧版板箱过磅,使用 GjcBoxWeighingActivity 替代")
|
||||||
@Route(path = ARouterConstants.ACTIVITY_URL_GJC_FU_BANG)
|
@Route(path = ARouterConstants.ACTIVITY_URL_GJC_FU_BANG)
|
||||||
class GjcFuBangActivity : BaseActivity(), View.OnClickListener {
|
class GjcFuBangActivity : BaseActivity(), View.OnClickListener {
|
||||||
private lateinit var viewModel: GjcFuBangViewModel
|
private lateinit var viewModel: GjcFuBangViewModel
|
||||||
|
|||||||
@@ -2,12 +2,14 @@ package com.lukouguoji.gjj.activity
|
|||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import androidx.appcompat.app.AppCompatActivity
|
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
|
import androidx.recyclerview.widget.LinearLayoutManager
|
||||||
import com.lukouguoji.gjj.R
|
import com.lukouguoji.gjj.R
|
||||||
import com.lukouguoji.gjj.databinding.ActivityGjjManifestDetailsBinding
|
import com.lukouguoji.gjj.databinding.ActivityGjjManifestDetailsBinding
|
||||||
|
import com.lukouguoji.gjj.holder.GjjManifestPicViewHolder
|
||||||
import com.lukouguoji.gjj.viewModel.GjjManifestDetailsViewModel
|
import com.lukouguoji.gjj.viewModel.GjjManifestDetailsViewModel
|
||||||
import com.lukouguoji.module_base.base.BaseBindingActivity
|
import com.lukouguoji.module_base.base.BaseBindingActivity
|
||||||
|
import com.lukouguoji.module_base.base.CommonAdapter
|
||||||
import com.lukouguoji.module_base.common.Constant
|
import com.lukouguoji.module_base.common.Constant
|
||||||
import com.lukouguoji.module_base.ktx.noNull
|
import com.lukouguoji.module_base.ktx.noNull
|
||||||
|
|
||||||
@@ -21,17 +23,33 @@ class GjjManifestDetailsActivity :
|
|||||||
override fun initOnCreate(savedInstanceState: Bundle?) {
|
override fun initOnCreate(savedInstanceState: Bundle?) {
|
||||||
setBackArrow("国际进港舱单详情")
|
setBackArrow("国际进港舱单详情")
|
||||||
viewModel.id = intent.getStringExtra(Constant.Key.ID).noNull()
|
viewModel.id = intent.getStringExtra(Constant.Key.ID).noNull()
|
||||||
|
viewModel.pic = intent.getStringExtra(Constant.Key.PIC).noNull()
|
||||||
|
viewModel.originalPic = intent.getStringExtra(Constant.Key.ORIGINAL_PIC).noNull()
|
||||||
|
|
||||||
binding.viewModel = viewModel
|
binding.viewModel = viewModel
|
||||||
|
|
||||||
|
val picAdapter = CommonAdapter(
|
||||||
|
this,
|
||||||
|
R.layout.item_gjj_manifest_pic,
|
||||||
|
GjjManifestPicViewHolder::class.java
|
||||||
|
)
|
||||||
|
binding.rvPic.layoutManager = LinearLayoutManager(this, LinearLayoutManager.HORIZONTAL, false)
|
||||||
|
binding.rvPic.adapter = picAdapter
|
||||||
|
|
||||||
|
viewModel.picList.observe(this) { list ->
|
||||||
|
picAdapter.refresh(list)
|
||||||
|
}
|
||||||
|
|
||||||
viewModel.getData()
|
viewModel.getData()
|
||||||
}
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
fun start(context: Context, id: String) {
|
fun start(context: Context, id: String, pic: String = "", originalPic: String = "") {
|
||||||
val starter = Intent(context, GjjManifestDetailsActivity::class.java)
|
val starter = Intent(context, GjjManifestDetailsActivity::class.java)
|
||||||
.putExtra(Constant.Key.ID, id)
|
.putExtra(Constant.Key.ID, id)
|
||||||
|
.putExtra(Constant.Key.PIC, pic)
|
||||||
|
.putExtra(Constant.Key.ORIGINAL_PIC, originalPic)
|
||||||
context.startActivity(starter)
|
context.startActivity(starter)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ import com.lukouguoji.module_base.base.CommonAdapter
|
|||||||
import com.lukouguoji.module_base.ktx.addOnItemClickListener
|
import com.lukouguoji.module_base.ktx.addOnItemClickListener
|
||||||
import com.lukouguoji.module_base.router.ARouterConstants
|
import com.lukouguoji.module_base.router.ARouterConstants
|
||||||
|
|
||||||
|
@Deprecated("旧的实现")
|
||||||
@Route(path = ARouterConstants.ACTIVITY_URL_GJJ_MANIFEST)
|
@Route(path = ARouterConstants.ACTIVITY_URL_GJJ_MANIFEST)
|
||||||
class GjjManifestListActivity :
|
class GjjManifestListActivity :
|
||||||
BaseBindingActivity<ActivityGjjManifestBinding, GjjManifestListViewModel>() {
|
BaseBindingActivity<ActivityGjjManifestBinding, GjjManifestListViewModel>() {
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ import com.lukouguoji.module_base.BaseActivity
|
|||||||
import com.lukouguoji.module_base.common.Constant
|
import com.lukouguoji.module_base.common.Constant
|
||||||
import com.lukouguoji.module_base.router.ARouterConstants
|
import com.lukouguoji.module_base.router.ARouterConstants
|
||||||
|
|
||||||
|
@Deprecated("旧版国际进港查询详情,使用 IntImpQueryDetailsActivity 替代")
|
||||||
// @Route(path = ARouterConstants.ACTIVITY_URL_GJJ_QUERY_INFO) // 已替换为 IntImpQueryDetailsActivity
|
// @Route(path = ARouterConstants.ACTIVITY_URL_GJJ_QUERY_INFO) // 已替换为 IntImpQueryDetailsActivity
|
||||||
class GjjQueryInfoActivity : BaseActivity(), View.OnClickListener {
|
class GjjQueryInfoActivity : BaseActivity(), View.OnClickListener {
|
||||||
|
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ import com.scwang.smart.refresh.layout.api.RefreshLayout
|
|||||||
import java.text.SimpleDateFormat
|
import java.text.SimpleDateFormat
|
||||||
import java.util.*
|
import java.util.*
|
||||||
|
|
||||||
|
@Deprecated("旧版国际进港查询列表,使用 IntImpQueryActivity 替代")
|
||||||
//@Route(path = ARouterConstants.ACTIVITY_URL_GJJ_QUERY_LIST)
|
//@Route(path = ARouterConstants.ACTIVITY_URL_GJJ_QUERY_LIST)
|
||||||
class GjjQueryListActivity : BaseActivity(), View.OnClickListener {
|
class GjjQueryListActivity : BaseActivity(), View.OnClickListener {
|
||||||
private val currentTitleName = "国际进港查询"
|
private val currentTitleName = "国际进港查询"
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package com.lukouguoji.gjj.activity
|
|||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
|
import android.text.InputType
|
||||||
import com.lukouguoji.gjj.R
|
import com.lukouguoji.gjj.R
|
||||||
import com.lukouguoji.gjj.databinding.ActivityIntImpAccidentVisaEditBinding
|
import com.lukouguoji.gjj.databinding.ActivityIntImpAccidentVisaEditBinding
|
||||||
import com.lukouguoji.gjj.viewModel.IntImpAccidentVisaEditViewModel
|
import com.lukouguoji.gjj.viewModel.IntImpAccidentVisaEditViewModel
|
||||||
@@ -26,8 +27,8 @@ class IntImpAccidentVisaEditActivity :
|
|||||||
|
|
||||||
// 航班号:大写字母+数字
|
// 航班号:大写字母+数字
|
||||||
binding.fnoInput.et.setUpperCaseAlphanumericFilter()
|
binding.fnoInput.et.setUpperCaseAlphanumericFilter()
|
||||||
// 运单号:大写字母+数字
|
// 运单号:纯数字11位
|
||||||
binding.wbNoInput.et.setUpperCaseAlphanumericFilter()
|
binding.wbNoInput.et.inputType = InputType.TYPE_CLASS_NUMBER
|
||||||
|
|
||||||
viewModel.rv = binding.rv
|
viewModel.rv = binding.rv
|
||||||
binding.rv.addOnItemClickListener(viewModel)
|
binding.rv.addOnItemClickListener(viewModel)
|
||||||
|
|||||||
@@ -108,7 +108,12 @@ class IntImpLoadingListActivity :
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
IntImpModifyStorageDialogModel { dialog ->
|
// 单选时自动带出该项的库位号,多选不带出
|
||||||
|
val presetLocation = if (selectedItems.size == 1) selectedItems.first().locationTally ?: "" else ""
|
||||||
|
|
||||||
|
IntImpModifyStorageDialogModel(
|
||||||
|
currentLocationName = presetLocation
|
||||||
|
) { dialog ->
|
||||||
val locationName = dialog.locationName
|
val locationName = dialog.locationName
|
||||||
val locationId = dialog.locationId
|
val locationId = dialog.locationId
|
||||||
viewModel.performModifyStorage(locationName, locationId, selectedItems)
|
viewModel.performModifyStorage(locationName, locationId, selectedItems)
|
||||||
|
|||||||
@@ -3,14 +3,20 @@ package com.lukouguoji.gjj.activity
|
|||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
|
import androidx.recyclerview.widget.LinearLayoutManager
|
||||||
import com.alibaba.android.arouter.facade.annotation.Route
|
import com.alibaba.android.arouter.facade.annotation.Route
|
||||||
import com.lukouguoji.gjj.R
|
import com.lukouguoji.gjj.R
|
||||||
import com.lukouguoji.gjj.databinding.ActivityIntImpManifestDetailsBinding
|
import com.lukouguoji.gjj.databinding.ActivityIntImpManifestDetailsBinding
|
||||||
|
import com.lukouguoji.gjj.holder.GjjManifestPicViewHolder
|
||||||
import com.lukouguoji.gjj.viewModel.IntImpManifestDetailsViewModel
|
import com.lukouguoji.gjj.viewModel.IntImpManifestDetailsViewModel
|
||||||
import com.lukouguoji.module_base.base.BaseBindingActivity
|
import com.lukouguoji.module_base.base.BaseBindingActivity
|
||||||
|
import com.lukouguoji.module_base.base.CommonAdapter
|
||||||
|
import com.lukouguoji.module_base.bean.FileBean
|
||||||
import com.lukouguoji.module_base.bean.GjjManifest
|
import com.lukouguoji.module_base.bean.GjjManifest
|
||||||
import com.lukouguoji.module_base.common.Constant
|
import com.lukouguoji.module_base.common.Constant
|
||||||
import com.lukouguoji.module_base.router.ARouterConstants
|
import com.lukouguoji.module_base.router.ARouterConstants
|
||||||
|
import com.lukouguoji.module_base.util.MediaUtil
|
||||||
|
import com.lukouguoji.module_base.ktx.noNull
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 国际进港舱单详情
|
* 国际进港舱单详情
|
||||||
@@ -26,6 +32,29 @@ class IntImpManifestDetailsActivity :
|
|||||||
setBackArrow("进港舱单详情")
|
setBackArrow("进港舱单详情")
|
||||||
binding.viewModel = viewModel
|
binding.viewModel = viewModel
|
||||||
viewModel.initOnCreated(intent)
|
viewModel.initOnCreated(intent)
|
||||||
|
|
||||||
|
// 交接图片
|
||||||
|
val picAdapter = CommonAdapter(
|
||||||
|
this,
|
||||||
|
R.layout.item_gjj_manifest_pic,
|
||||||
|
GjjManifestPicViewHolder::class.java
|
||||||
|
)
|
||||||
|
binding.rvPic.layoutManager = LinearLayoutManager(this, LinearLayoutManager.HORIZONTAL, false)
|
||||||
|
binding.rvPic.adapter = picAdapter
|
||||||
|
|
||||||
|
viewModel.dataBean.observe(this) { bean ->
|
||||||
|
val picList = bean.pic.noNull().split(",").filter { it.isNotEmpty() }
|
||||||
|
val originalPicList = bean.originalPic.noNull().split(",").filter { it.isNotEmpty() }
|
||||||
|
val list = picList.mapIndexed { index, picUrl ->
|
||||||
|
val originalFile = originalPicList.getOrElse(index) { picUrl }
|
||||||
|
FileBean(
|
||||||
|
path = MediaUtil.fillUrl(picUrl),
|
||||||
|
url = picUrl,
|
||||||
|
originalPic = MediaUtil.fillUrl(originalFile)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
picAdapter.refresh(list)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ import dev.utils.app.info.KeyValue
|
|||||||
*/
|
*/
|
||||||
class IntImpModifyStorageDialogModel(
|
class IntImpModifyStorageDialogModel(
|
||||||
private val currentLocationId: String = "",
|
private val currentLocationId: String = "",
|
||||||
|
private val currentLocationName: String = "",
|
||||||
private val callback: (IntImpModifyStorageDialogModel) -> Unit
|
private val callback: (IntImpModifyStorageDialogModel) -> Unit
|
||||||
) : BaseDialogModel<DialogIntImpModifyStorageBinding>(DIALOG_TYPE_CENTER) {
|
) : BaseDialogModel<DialogIntImpModifyStorageBinding>(DIALOG_TYPE_CENTER) {
|
||||||
|
|
||||||
@@ -55,9 +56,14 @@ class IntImpModifyStorageDialogModel(
|
|||||||
onSuccess = { result ->
|
onSuccess = { result ->
|
||||||
val list = result.data?.map { it.toKeyValue() } ?: emptyList()
|
val list = result.data?.map { it.toKeyValue() } ?: emptyList()
|
||||||
locationList.value = list
|
locationList.value = list
|
||||||
// 列表加载完成后,预选当前库位
|
// 列表加载完成后,预选当前库位(优先按ID匹配,其次按名称匹配)
|
||||||
if (currentLocationId.isNotEmpty()) {
|
if (currentLocationId.isNotEmpty()) {
|
||||||
selectedLocationCode.value = currentLocationId
|
selectedLocationCode.value = currentLocationId
|
||||||
|
} else if (currentLocationName.isNotEmpty()) {
|
||||||
|
val matched = list.find { it.key == currentLocationName }
|
||||||
|
if (matched != null) {
|
||||||
|
selectedLocationCode.value = matched.value
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
onFailed = { _, msg ->
|
onFailed = { _, msg ->
|
||||||
|
|||||||
@@ -0,0 +1,42 @@
|
|||||||
|
package com.lukouguoji.gjj.holder
|
||||||
|
|
||||||
|
import android.view.View
|
||||||
|
import com.bumptech.glide.Glide
|
||||||
|
import com.bumptech.glide.load.model.GlideUrl
|
||||||
|
import com.bumptech.glide.load.model.LazyHeaders
|
||||||
|
import com.lukouguoji.gjj.databinding.ItemGjjManifestPicBinding
|
||||||
|
import com.lukouguoji.module_base.base.BaseViewHolder
|
||||||
|
import com.lukouguoji.module_base.bean.FileBean
|
||||||
|
import com.lukouguoji.module_base.common.Constant
|
||||||
|
import com.lukouguoji.module_base.db.perference.SharedPreferenceUtil
|
||||||
|
import com.lukouguoji.module_base.ktx.commonAdapter
|
||||||
|
import com.lukouguoji.module_base.ui.page.preview.PreviewActivity
|
||||||
|
|
||||||
|
class GjjManifestPicViewHolder(view: View) :
|
||||||
|
BaseViewHolder<FileBean, ItemGjjManifestPicBinding>(view) {
|
||||||
|
|
||||||
|
override fun onBind(item: Any?, position: Int) {
|
||||||
|
val bean = getItemBean(item)!!
|
||||||
|
binding.bean = bean
|
||||||
|
|
||||||
|
// 带 Authorization header 加载图片
|
||||||
|
if (bean.path.isNotEmpty()) {
|
||||||
|
val glideUrl = GlideUrl(
|
||||||
|
bean.path,
|
||||||
|
LazyHeaders.Builder()
|
||||||
|
.addHeader("Authorization", SharedPreferenceUtil.getString(Constant.Share.token))
|
||||||
|
.build()
|
||||||
|
)
|
||||||
|
Glide.with(itemView.context).load(glideUrl).into(binding.ivThumbnail)
|
||||||
|
}
|
||||||
|
|
||||||
|
binding.ivThumbnail.setOnClickListener {
|
||||||
|
val items = getRecyclerView()?.commonAdapter()?.items
|
||||||
|
?.filterIsInstance<FileBean>() ?: listOf(bean)
|
||||||
|
val originalList = items.map { fb ->
|
||||||
|
FileBean(path = if (fb.originalPic.isNotEmpty()) fb.originalPic else fb.path)
|
||||||
|
}
|
||||||
|
PreviewActivity.start(itemView.context, originalList, position)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,11 +1,9 @@
|
|||||||
package com.lukouguoji.gjj.holder
|
package com.lukouguoji.gjj.holder
|
||||||
|
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import androidx.recyclerview.widget.RecyclerView
|
|
||||||
import com.lukouguoji.gjj.databinding.ItemIntImpManifestSubBinding
|
import com.lukouguoji.gjj.databinding.ItemIntImpManifestSubBinding
|
||||||
import com.lukouguoji.module_base.base.BaseViewHolder
|
import com.lukouguoji.module_base.base.BaseViewHolder
|
||||||
import com.lukouguoji.module_base.bean.GjjHaWb
|
import com.lukouguoji.module_base.bean.GjjHaWb
|
||||||
import com.lukouguoji.module_base.bean.GjjManifest
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 国际进港舱单 - 分单子列表 ViewHolder
|
* 国际进港舱单 - 分单子列表 ViewHolder
|
||||||
@@ -24,13 +22,6 @@ class IntImpManifestSubViewHolder(view: View) :
|
|||||||
val newCheckedState = !bean.checked.get()
|
val newCheckedState = !bean.checked.get()
|
||||||
bean.checked.set(newCheckedState)
|
bean.checked.set(newCheckedState)
|
||||||
binding.executePendingBindings()
|
binding.executePendingBindings()
|
||||||
|
|
||||||
// 反向联动主列表项(勾选子项时自动勾选父项)
|
|
||||||
if (newCheckedState) {
|
|
||||||
val recyclerView = itemView.parent as? RecyclerView ?: return@setOnClickListener
|
|
||||||
val parentBean = recyclerView.tag as? GjjManifest ?: return@setOnClickListener
|
|
||||||
parentBean.checked.set(true)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,10 +25,7 @@ class IntImpManifestViewHolder(view: View) :
|
|||||||
binding.ivIcon.setOnClickListener {
|
binding.ivIcon.setOnClickListener {
|
||||||
val newCheckedState = !bean.checked.get()
|
val newCheckedState = !bean.checked.get()
|
||||||
bean.checked.set(newCheckedState)
|
bean.checked.set(newCheckedState)
|
||||||
// 联动子列表选中状态
|
|
||||||
bean.haWbList?.forEach { sub -> sub.checked.set(newCheckedState) }
|
|
||||||
binding.executePendingBindings()
|
binding.executePendingBindings()
|
||||||
binding.rvSub.adapter?.notifyDataSetChanged()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 整卡点击 - 跳转详情页
|
// 整卡点击 - 跳转详情页
|
||||||
@@ -46,7 +43,7 @@ class IntImpManifestViewHolder(view: View) :
|
|||||||
|
|
||||||
// 展开按钮颜色:绿色背景时黑色,否则保持原色
|
// 展开按钮颜色:绿色背景时黑色,否则保持原色
|
||||||
if (bean.ref == "1") {
|
if (bean.ref == "1") {
|
||||||
binding.ivShow.setColorFilter(Color.BLACK)
|
binding.ivShow.setColorFilter(Color.parseColor("#666666"))
|
||||||
} else {
|
} else {
|
||||||
binding.ivShow.clearColorFilter()
|
binding.ivShow.clearColorFilter()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,10 +1,8 @@
|
|||||||
package com.lukouguoji.gjj.holder
|
package com.lukouguoji.gjj.holder
|
||||||
|
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import androidx.recyclerview.widget.RecyclerView
|
|
||||||
import com.lukouguoji.gjj.databinding.ItemIntImpStorageUseSubBinding
|
import com.lukouguoji.gjj.databinding.ItemIntImpStorageUseSubBinding
|
||||||
import com.lukouguoji.module_base.base.BaseViewHolder
|
import com.lukouguoji.module_base.base.BaseViewHolder
|
||||||
import com.lukouguoji.module_base.bean.GjcMaWb
|
|
||||||
import com.lukouguoji.module_base.bean.GjcStorageUse
|
import com.lukouguoji.module_base.bean.GjcStorageUse
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -19,27 +17,10 @@ class IntImpStorageUseSubViewHolder(view: View) :
|
|||||||
binding.position = position
|
binding.position = position
|
||||||
binding.executePendingBindings()
|
binding.executePendingBindings()
|
||||||
|
|
||||||
// 单选框点击切换选择状态(反向联动主列表)
|
// 单选框点击切换选择状态
|
||||||
binding.ivCheckbox.setOnClickListener {
|
binding.ivCheckbox.setOnClickListener {
|
||||||
// 切换子列表项的选择状态
|
bean.checked.set(!bean.checked.get())
|
||||||
val newCheckedState = !bean.checked.get()
|
|
||||||
bean.checked.set(newCheckedState)
|
|
||||||
binding.executePendingBindings()
|
binding.executePendingBindings()
|
||||||
|
|
||||||
// 反向联动主列表项(仅在勾选时联动)
|
|
||||||
updateParentCheckState(newCheckedState)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 更新父列表项的选择状态
|
|
||||||
*/
|
|
||||||
private fun updateParentCheckState(newCheckedState: Boolean) {
|
|
||||||
val recyclerView = itemView.parent as? RecyclerView ?: return
|
|
||||||
val parentBean = recyclerView.tag as? GjcMaWb ?: return
|
|
||||||
|
|
||||||
if (newCheckedState) {
|
|
||||||
parentBean.checked.set(true)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,18 +20,10 @@ class IntImpStorageUseViewHolder(view: View) :
|
|||||||
binding.position = position
|
binding.position = position
|
||||||
binding.executePendingBindings()
|
binding.executePendingBindings()
|
||||||
|
|
||||||
// 图标点击切换选择状态(联动子列表)
|
// 图标点击切换选择状态
|
||||||
binding.ivIcon.setOnClickListener {
|
binding.ivIcon.setOnClickListener {
|
||||||
val newCheckedState = !bean.checked.get()
|
bean.checked.set(!bean.checked.get())
|
||||||
bean.checked.set(newCheckedState)
|
|
||||||
|
|
||||||
// 联动勾选/取消所有子列表项
|
|
||||||
bean.storageUseList?.forEach { storageUse ->
|
|
||||||
storageUse.checked.set(newCheckedState)
|
|
||||||
}
|
|
||||||
|
|
||||||
binding.executePendingBindings()
|
binding.executePendingBindings()
|
||||||
binding.rvSub.adapter?.notifyDataSetChanged()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 展开按钮点击事件
|
// 展开按钮点击事件
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
package com.lukouguoji.gjj.holder
|
package com.lukouguoji.gjj.holder
|
||||||
|
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import androidx.recyclerview.widget.RecyclerView
|
|
||||||
import com.lukouguoji.gjj.databinding.ItemIntImpTallySubBinding
|
import com.lukouguoji.gjj.databinding.ItemIntImpTallySubBinding
|
||||||
import com.lukouguoji.module_base.base.BaseViewHolder
|
import com.lukouguoji.module_base.base.BaseViewHolder
|
||||||
import com.lukouguoji.module_base.bean.GjjImportTally
|
import com.lukouguoji.module_base.bean.GjjImportTally
|
||||||
@@ -18,26 +17,10 @@ class IntImpTallySubViewHolder(view: View) :
|
|||||||
binding.position = position
|
binding.position = position
|
||||||
binding.executePendingBindings()
|
binding.executePendingBindings()
|
||||||
|
|
||||||
// 单选框点击切换选择状态(反向联动主列表)
|
// 单选框点击切换选择状态(独立选择,不联动主单)
|
||||||
binding.ivCheckbox.setOnClickListener {
|
binding.ivCheckbox.setOnClickListener {
|
||||||
val newCheckedState = !bean.checked.get()
|
bean.checked.set(!bean.checked.get())
|
||||||
bean.checked.set(newCheckedState)
|
|
||||||
binding.executePendingBindings()
|
binding.executePendingBindings()
|
||||||
|
|
||||||
// 反向联动主列表项(勾选时联动主项也勾选)
|
|
||||||
updateParentCheckState(newCheckedState)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 更新父列表项的选择状态
|
|
||||||
*/
|
|
||||||
private fun updateParentCheckState(newCheckedState: Boolean) {
|
|
||||||
val recyclerView = itemView.parent as? RecyclerView ?: return
|
|
||||||
val parentBean = recyclerView.tag as? GjjImportTally ?: return
|
|
||||||
|
|
||||||
if (newCheckedState) {
|
|
||||||
parentBean.checked.set(true)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,18 +25,10 @@ class IntImpTallyViewHolder(view: View) :
|
|||||||
binding.position = position
|
binding.position = position
|
||||||
binding.executePendingBindings()
|
binding.executePendingBindings()
|
||||||
|
|
||||||
// 选中图标点击 - 切换选择状态(联动子列表)
|
// 选中图标点击 - 切换选择状态(独立选择,不联动分单)
|
||||||
binding.ivIcon.setOnClickListener {
|
binding.ivIcon.setOnClickListener {
|
||||||
val newCheckedState = !bean.checked.get()
|
bean.checked.set(!bean.checked.get())
|
||||||
bean.checked.set(newCheckedState)
|
|
||||||
|
|
||||||
// 联动勾选/取消所有子列表项
|
|
||||||
bean.haWbList?.forEach { sub ->
|
|
||||||
sub.checked.set(newCheckedState)
|
|
||||||
}
|
|
||||||
|
|
||||||
binding.executePendingBindings()
|
binding.executePendingBindings()
|
||||||
binding.rvSub.adapter?.notifyDataSetChanged()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 整个内容区域点击 - 跳转到详情页
|
// 整个内容区域点击 - 跳转到详情页
|
||||||
|
|||||||
@@ -32,6 +32,10 @@ class GjjManifestAddViewModel : BaseViewModel() {
|
|||||||
// 舱单ID(编辑时使用)
|
// 舱单ID(编辑时使用)
|
||||||
var mfId: Long = 0
|
var mfId: Long = 0
|
||||||
|
|
||||||
|
// 编号和前缀(编辑时使用)
|
||||||
|
var no: String = ""
|
||||||
|
var prefix: String = ""
|
||||||
|
|
||||||
// 航班ID
|
// 航班ID
|
||||||
var fid: String = ""
|
var fid: String = ""
|
||||||
|
|
||||||
@@ -153,51 +157,13 @@ class GjjManifestAddViewModel : BaseViewModel() {
|
|||||||
val specialCodeList = MutableLiveData<List<KeyValue>>()
|
val specialCodeList = MutableLiveData<List<KeyValue>>()
|
||||||
val specialCode = MutableLiveData("")
|
val specialCode = MutableLiveData("")
|
||||||
|
|
||||||
// 货物类型
|
// 货物类型(无下拉列表,仅用于编辑模式回传)
|
||||||
val goodsTypeList = MutableLiveData<List<KeyValue>>()
|
|
||||||
val goodsType = MutableLiveData("")
|
val goodsType = MutableLiveData("")
|
||||||
|
|
||||||
// 运单类型
|
// 运单类型
|
||||||
val waybillTypeList = MutableLiveData<List<KeyValue>>()
|
val waybillTypeList = MutableLiveData<List<KeyValue>>()
|
||||||
val waybillType = MutableLiveData("")
|
val waybillType = MutableLiveData("")
|
||||||
|
|
||||||
init {
|
|
||||||
DictUtils.getIntImpAgentList(addAll = false) {
|
|
||||||
agentList.postValue(listOf(KeyValue("", "")) + it)
|
|
||||||
}
|
|
||||||
DictUtils.getSpecialCodeList(addAll = false, flag = 1, ieFlag = "") {
|
|
||||||
val list = arrayListOf<KeyValue>()
|
|
||||||
it.find { b -> b.key.contains("普通货物") }?.let { b ->
|
|
||||||
list.add(b)
|
|
||||||
}
|
|
||||||
list.addAll(it.filter { b -> !b.key.contains("普通货物") })
|
|
||||||
specialCodeList.postValue(list)
|
|
||||||
}
|
|
||||||
DictUtils.getBusinessTypeList(addAll = false) {
|
|
||||||
businessTypeList.postValue(it)
|
|
||||||
// 新增模式下默认选中"普通货物运输"
|
|
||||||
if (pageType.value == DetailsPageType.Add && businessType.value.isNullOrEmpty()) {
|
|
||||||
it.find { b -> b.key.contains("普通货物运输") }?.let { b ->
|
|
||||||
businessType.postValue(b.value)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
DictUtils.getShouYunPackageTypeList {
|
|
||||||
packageTypeList.postValue(listOf(KeyValue("", "")) + it)
|
|
||||||
}
|
|
||||||
DictUtils.getGjjGoodsTypeList(addAll = false) {
|
|
||||||
goodsTypeList.postValue(it)
|
|
||||||
}
|
|
||||||
DictUtils.getWaybillTypeList(type = "II", addAll = false) {
|
|
||||||
val list = arrayListOf<KeyValue>()
|
|
||||||
it.find { b -> b.key.contains("干线") }?.let { b ->
|
|
||||||
list.add(b)
|
|
||||||
}
|
|
||||||
list.addAll(it.filter { b -> !b.key.contains("干线") })
|
|
||||||
waybillTypeList.postValue(list)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 初始化(从Intent获取参数)
|
* 初始化(从Intent获取参数)
|
||||||
*/
|
*/
|
||||||
@@ -235,6 +201,71 @@ class GjjManifestAddViewModel : BaseViewModel() {
|
|||||||
loadManifestFromImportBean(bean)
|
loadManifestFromImportBean(bean)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 加载下拉列表(在编辑数据加载之后,以便使用 checkedValue 将选中项置顶)
|
||||||
|
loadDictLists()
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 加载下拉列表数据
|
||||||
|
* 编辑模式下传入 checkedValue,handleCallBack 会将匹配项置于列表首位,
|
||||||
|
* Spinner 默认显示首项即完成回填
|
||||||
|
*/
|
||||||
|
private fun loadDictLists() {
|
||||||
|
val isModify = pageType.value == DetailsPageType.Modify
|
||||||
|
|
||||||
|
DictUtils.getIntImpAgentList(
|
||||||
|
addAll = false,
|
||||||
|
checkedValue = if (isModify) agent.value else null
|
||||||
|
) {
|
||||||
|
agentList.postValue(if (isModify) it else listOf(KeyValue("", "")) + it)
|
||||||
|
}
|
||||||
|
|
||||||
|
DictUtils.getSpecialCodeList(
|
||||||
|
addAll = false, flag = 1, ieFlag = "",
|
||||||
|
checkedValue = if (isModify) specialCode.value else null
|
||||||
|
) {
|
||||||
|
if (isModify) {
|
||||||
|
specialCodeList.postValue(it)
|
||||||
|
} else {
|
||||||
|
val list = arrayListOf<KeyValue>()
|
||||||
|
it.find { b -> b.key.contains("普通货物") }?.let { b -> list.add(b) }
|
||||||
|
list.addAll(it.filter { b -> !b.key.contains("普通货物") })
|
||||||
|
specialCodeList.postValue(list)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
DictUtils.getBusinessTypeList(
|
||||||
|
addAll = false,
|
||||||
|
checkedValue = if (isModify) businessType.value else null
|
||||||
|
) {
|
||||||
|
businessTypeList.postValue(it)
|
||||||
|
if (!isModify && businessType.value.isNullOrEmpty()) {
|
||||||
|
it.find { b -> b.key.contains("普通货物运输") }?.let { b ->
|
||||||
|
businessType.postValue(b.value)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
DictUtils.getShouYunPackageTypeList(
|
||||||
|
checkedValue = if (isModify) packageType.value else null
|
||||||
|
) {
|
||||||
|
packageTypeList.postValue(if (isModify) it else listOf(KeyValue("", "")) + it)
|
||||||
|
}
|
||||||
|
|
||||||
|
DictUtils.getWaybillTypeList(
|
||||||
|
type = "II", addAll = false,
|
||||||
|
checkedValue = if (isModify) waybillType.value else null
|
||||||
|
) {
|
||||||
|
if (isModify) {
|
||||||
|
waybillTypeList.postValue(it)
|
||||||
|
} else {
|
||||||
|
val list = arrayListOf<KeyValue>()
|
||||||
|
it.find { b -> b.key.contains("干线") }?.let { b -> list.add(b) }
|
||||||
|
list.addAll(it.filter { b -> !b.key.contains("干线") })
|
||||||
|
waybillTypeList.postValue(list)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -244,9 +275,11 @@ class GjjManifestAddViewModel : BaseViewModel() {
|
|||||||
// 保存舱单ID
|
// 保存舱单ID
|
||||||
mfId = manifest.mfId
|
mfId = manifest.mfId
|
||||||
fid = manifest.fid.toString()
|
fid = manifest.fid.toString()
|
||||||
|
no = manifest.no
|
||||||
|
prefix = manifest.prefix
|
||||||
|
|
||||||
// 填充表单字段
|
// 填充表单字段
|
||||||
waybillNo.value = manifest.wbNo
|
waybillNo.value = manifest.getWaybillNo()
|
||||||
waybillNum.value = manifest.totalPc.toString()
|
waybillNum.value = manifest.totalPc.toString()
|
||||||
actualNum.value = manifest.pc.toString()
|
actualNum.value = manifest.pc.toString()
|
||||||
actualWeight.value = manifest.weight.toString()
|
actualWeight.value = manifest.weight.toString()
|
||||||
@@ -272,9 +305,11 @@ class GjjManifestAddViewModel : BaseViewModel() {
|
|||||||
*/
|
*/
|
||||||
private fun loadManifestFromImportBean(manifest: com.lukouguoji.module_base.bean.GjjImportManifest) {
|
private fun loadManifestFromImportBean(manifest: com.lukouguoji.module_base.bean.GjjImportManifest) {
|
||||||
fid = manifest.fid.toString()
|
fid = manifest.fid.toString()
|
||||||
|
no = manifest.no
|
||||||
|
prefix = manifest.prefix
|
||||||
|
|
||||||
// 填充表单字段
|
// 填充表单字段
|
||||||
waybillNo.value = manifest.wbNo
|
waybillNo.value = "${manifest.prefix}${manifest.no}"
|
||||||
waybillNum.value = manifest.totalPc.toString()
|
waybillNum.value = manifest.totalPc.toString()
|
||||||
actualNum.value = manifest.pc.toString()
|
actualNum.value = manifest.pc.toString()
|
||||||
actualWeight.value = manifest.weight.toString()
|
actualWeight.value = manifest.weight.toString()
|
||||||
@@ -324,7 +359,10 @@ class GjjManifestAddViewModel : BaseViewModel() {
|
|||||||
|| verifyWaybillNo(waybillNo.value)
|
|| verifyWaybillNo(waybillNo.value)
|
||||||
|| agent.value.verifyNullOrEmpty("请选择代理")
|
|| agent.value.verifyNullOrEmpty("请选择代理")
|
||||||
|| waybillNum.value.verifyNullOrEmpty("请输入运单件数")
|
|| waybillNum.value.verifyNullOrEmpty("请输入运单件数")
|
||||||
|
|| actualNum.value.verifyNullOrEmpty("请输入实到件数")
|
||||||
|| actualWeight.value.verifyNullOrEmpty("请输入实到重量")
|
|| actualWeight.value.verifyNullOrEmpty("请输入实到重量")
|
||||||
|
|| billingWeight.value.verifyNullOrEmpty("请输入计费重量")
|
||||||
|
|| goodsNameCn.value.verifyNullOrEmpty("请输入品名(中)")
|
||||||
|| goodsNameEn.value.verifyNullOrEmpty("请输入品名(英)")
|
|| goodsNameEn.value.verifyNullOrEmpty("请输入品名(英)")
|
||||||
|| waybillType.value.verifyNullOrEmpty("请选择运单类型")
|
|| waybillType.value.verifyNullOrEmpty("请选择运单类型")
|
||||||
|| businessType.value.verifyNullOrEmpty("请选择业务类型")
|
|| businessType.value.verifyNullOrEmpty("请选择业务类型")
|
||||||
@@ -335,8 +373,9 @@ class GjjManifestAddViewModel : BaseViewModel() {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
val params = mapOf(
|
val isModify = pageType.value == DetailsPageType.Modify
|
||||||
"mfId" to if (pageType.value == DetailsPageType.Modify) mfId else null,
|
|
||||||
|
val paramsMap = mutableMapOf<String, Any?>(
|
||||||
"fid" to fid,
|
"fid" to fid,
|
||||||
"wbNo" to waybillNo.value,
|
"wbNo" to waybillNo.value,
|
||||||
"agentCode" to agent.value,
|
"agentCode" to agent.value,
|
||||||
@@ -346,19 +385,30 @@ class GjjManifestAddViewModel : BaseViewModel() {
|
|||||||
"pc" to actualNum.value,
|
"pc" to actualNum.value,
|
||||||
"weight" to actualWeight.value,
|
"weight" to actualWeight.value,
|
||||||
"cashWeight" to billingWeight.value,
|
"cashWeight" to billingWeight.value,
|
||||||
"packageType" to packageType.value,
|
|
||||||
"origin" to departure.value,
|
"origin" to departure.value,
|
||||||
"dest" to destination.value,
|
"dest" to destination.value,
|
||||||
"goods" to goodsNameEn.value,
|
"goods" to goodsNameEn.value,
|
||||||
"goodsCn" to goodsNameCn.value,
|
"goodsCn" to goodsNameCn.value,
|
||||||
"awbType" to waybillType.value,
|
"awbType" to waybillType.value,
|
||||||
"cargoType" to goodsType.value,
|
)
|
||||||
"unNumber" to unNumber.value,
|
|
||||||
"remark" to remark.value,
|
// 可选字段:非空时才传
|
||||||
).toRequestBody(removeEmptyOrNull = true)
|
if (!packageType.value.isNullOrEmpty()) paramsMap["packageType"] = packageType.value
|
||||||
|
if (!goodsType.value.isNullOrEmpty()) paramsMap["cargoType"] = goodsType.value
|
||||||
|
if (!unNumber.value.isNullOrEmpty()) paramsMap["unNumber"] = unNumber.value
|
||||||
|
if (!remark.value.isNullOrEmpty()) paramsMap["remark"] = remark.value
|
||||||
|
|
||||||
|
// 编辑模式:必须传 mfId、no、prefix(不受空字符串过滤影响)
|
||||||
|
if (isModify) {
|
||||||
|
paramsMap["mfId"] = mfId
|
||||||
|
paramsMap["no"] = no
|
||||||
|
paramsMap["prefix"] = prefix
|
||||||
|
}
|
||||||
|
|
||||||
|
val params = paramsMap.toRequestBody()
|
||||||
|
|
||||||
launchLoadingCollect({
|
launchLoadingCollect({
|
||||||
if (pageType.value == DetailsPageType.Modify) {
|
if (isModify) {
|
||||||
NetApply.api.gjjManifestUpdate(params)
|
NetApply.api.gjjManifestUpdate(params)
|
||||||
} else {
|
} else {
|
||||||
NetApply.api.gjjManifestInsert(params)
|
NetApply.api.gjjManifestInsert(params)
|
||||||
@@ -366,7 +416,7 @@ class GjjManifestAddViewModel : BaseViewModel() {
|
|||||||
}) {
|
}) {
|
||||||
onSuccess = {
|
onSuccess = {
|
||||||
if (it.verifySuccess()) {
|
if (it.verifySuccess()) {
|
||||||
val successMsg = if (pageType.value == DetailsPageType.Modify) "修改成功" else "保存成功"
|
val successMsg = if (isModify) "修改成功" else "保存成功"
|
||||||
showToast(successMsg)
|
showToast(successMsg)
|
||||||
|
|
||||||
// 发送刷新事件
|
// 发送刷新事件
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package com.lukouguoji.gjj.viewModel
|
|||||||
import android.view.View
|
import android.view.View
|
||||||
import androidx.lifecycle.MutableLiveData
|
import androidx.lifecycle.MutableLiveData
|
||||||
import com.lukouguoji.module_base.base.BaseViewModel
|
import com.lukouguoji.module_base.base.BaseViewModel
|
||||||
|
import com.lukouguoji.module_base.bean.FileBean
|
||||||
import com.lukouguoji.module_base.http.net.NetApply
|
import com.lukouguoji.module_base.http.net.NetApply
|
||||||
import com.lukouguoji.module_base.interfaces.IGetData
|
import com.lukouguoji.module_base.interfaces.IGetData
|
||||||
import com.lukouguoji.module_base.ktx.finish
|
import com.lukouguoji.module_base.ktx.finish
|
||||||
@@ -13,6 +14,7 @@ import com.lukouguoji.module_base.ktx.showToast
|
|||||||
import com.lukouguoji.module_base.ktx.toRequestBody
|
import com.lukouguoji.module_base.ktx.toRequestBody
|
||||||
import com.lukouguoji.module_base.ktx.verifyNullOrEmpty
|
import com.lukouguoji.module_base.ktx.verifyNullOrEmpty
|
||||||
import com.lukouguoji.module_base.util.DictUtils
|
import com.lukouguoji.module_base.util.DictUtils
|
||||||
|
import com.lukouguoji.module_base.util.MediaUtil
|
||||||
import dev.utils.app.info.KeyValue
|
import dev.utils.app.info.KeyValue
|
||||||
import dev.utils.common.DateUtils
|
import dev.utils.common.DateUtils
|
||||||
|
|
||||||
@@ -20,6 +22,13 @@ class GjjManifestDetailsViewModel : BaseViewModel(), IGetData {
|
|||||||
|
|
||||||
var id = ""
|
var id = ""
|
||||||
var fid = ""
|
var fid = ""
|
||||||
|
var no = ""
|
||||||
|
var prefix = ""
|
||||||
|
var pic = ""
|
||||||
|
var originalPic = ""
|
||||||
|
|
||||||
|
// 交接图片列表
|
||||||
|
val picList = MutableLiveData<List<FileBean>>(emptyList())
|
||||||
|
|
||||||
// 是否修改状态
|
// 是否修改状态
|
||||||
var modifyAble = MutableLiveData(false)
|
var modifyAble = MutableLiveData(false)
|
||||||
@@ -88,6 +97,7 @@ class GjjManifestDetailsViewModel : BaseViewModel(), IGetData {
|
|||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
override fun getData() {
|
override fun getData() {
|
||||||
|
parsePicList()
|
||||||
showLoading()
|
showLoading()
|
||||||
launchCollect({
|
launchCollect({
|
||||||
NetApply.api.getGjjManifestDetail(id)
|
NetApply.api.getGjjManifestDetail(id)
|
||||||
@@ -95,6 +105,8 @@ class GjjManifestDetailsViewModel : BaseViewModel(), IGetData {
|
|||||||
onSuccess = { result ->
|
onSuccess = { result ->
|
||||||
result.data?.let { data ->
|
result.data?.let { data ->
|
||||||
fid = data.fid.toString()
|
fid = data.fid.toString()
|
||||||
|
no = data.no
|
||||||
|
prefix = data.prefix
|
||||||
waybillNo.value = data.getWaybillCode().noNull()
|
waybillNo.value = data.getWaybillCode().noNull()
|
||||||
waybillNum.value = data.awbpc.toString()
|
waybillNum.value = data.awbpc.toString()
|
||||||
actualNum.value = data.pc.toString()
|
actualNum.value = data.pc.toString()
|
||||||
@@ -107,6 +119,14 @@ class GjjManifestDetailsViewModel : BaseViewModel(), IGetData {
|
|||||||
remark.value = data.remark.noNull()
|
remark.value = data.remark.noNull()
|
||||||
date.value = data.storageTime.noNull()
|
date.value = data.storageTime.noNull()
|
||||||
|
|
||||||
|
// 初始化下拉控件的选中值(避免 onSelected 回调时机不确定导致值丢失)
|
||||||
|
agent = data.agent.noNull()
|
||||||
|
specialCode = data.spCode.noNull()
|
||||||
|
businessType = data.businessType.noNull()
|
||||||
|
packageType = data.packagecode.noNull()
|
||||||
|
goodsType = data.cargoType.noNull()
|
||||||
|
waybillType = data.awbType.noNull()
|
||||||
|
|
||||||
DictUtils.getAgentList(addAll = false, checkedValue = data.agent) {
|
DictUtils.getAgentList(addAll = false, checkedValue = data.agent) {
|
||||||
agentList.postValue(it)
|
agentList.postValue(it)
|
||||||
}
|
}
|
||||||
@@ -207,6 +227,8 @@ class GjjManifestDetailsViewModel : BaseViewModel(), IGetData {
|
|||||||
mapOf(
|
mapOf(
|
||||||
"mfId" to id,
|
"mfId" to id,
|
||||||
"fid" to fid,
|
"fid" to fid,
|
||||||
|
"no" to no,
|
||||||
|
"prefix" to prefix,
|
||||||
"wbNo" to waybillNo.value,
|
"wbNo" to waybillNo.value,
|
||||||
"agent" to agent,
|
"agent" to agent,
|
||||||
"spCode" to specialCode,
|
"spCode" to specialCode,
|
||||||
@@ -248,4 +270,21 @@ class GjjManifestDetailsViewModel : BaseViewModel(), IGetData {
|
|||||||
fun onCancelClick(view: View) {
|
fun onCancelClick(view: View) {
|
||||||
modifyAble.value = false
|
modifyAble.value = false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 解析 pic / originalPic 字符串为 FileBean 列表
|
||||||
|
*/
|
||||||
|
fun parsePicList() {
|
||||||
|
val thumbUrls = pic.split(",").filter { it.isNotEmpty() }
|
||||||
|
val originalUrls = originalPic.split(",").filter { it.isNotEmpty() }
|
||||||
|
val list = thumbUrls.mapIndexed { index, thumbFile ->
|
||||||
|
val originalFile = originalUrls.getOrElse(index) { thumbFile }
|
||||||
|
FileBean(
|
||||||
|
path = MediaUtil.fillUrl(thumbFile),
|
||||||
|
url = thumbFile,
|
||||||
|
originalPic = MediaUtil.fillUrl(originalFile)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
picList.value = list
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -243,7 +243,7 @@ class GjjManifestListViewModel : BasePageViewModel(), IOnItemClickListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
R.id.tv_details -> {
|
R.id.tv_details -> {
|
||||||
GjjManifestDetailsActivity.start(DevUtils.getTopActivity(), bean.mfId)
|
GjjManifestDetailsActivity.start(DevUtils.getTopActivity(), bean.mfId, bean.pic, bean.originalPic)
|
||||||
}
|
}
|
||||||
|
|
||||||
R.id.tv_delete -> {
|
R.id.tv_delete -> {
|
||||||
|
|||||||
@@ -65,6 +65,51 @@ class IntArrSupplementInfoViewModel : BaseViewModel() {
|
|||||||
} else null
|
} else null
|
||||||
} ?: emptyList()
|
} ?: emptyList()
|
||||||
countryCodeList.value = keyValueList
|
countryCodeList.value = keyValueList
|
||||||
|
|
||||||
|
// 全量加载完成后,按始发站过滤查询,若唯一则自动选中
|
||||||
|
autoMatchCountryCodeByFdep()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据始发站/目的站自动匹配国家代码
|
||||||
|
* - 始发站(fdep) → 匹配发货人国家代码
|
||||||
|
* - 目的站(fdest) → 匹配收货人国家代码
|
||||||
|
*/
|
||||||
|
private fun autoMatchCountryCodeByFdep() {
|
||||||
|
val manifest = manifestList.firstOrNull() ?: return
|
||||||
|
val bean = dataBean.value ?: return
|
||||||
|
|
||||||
|
// 始发站 → 发货人国家代码
|
||||||
|
if (manifest.fdep.isNotEmpty() && bean.consignorCountryCode.isEmpty()) {
|
||||||
|
launchCollect({ NetApply.api.getCountryCodeListByFdep(manifest.fdep) }) {
|
||||||
|
onSuccess = { result ->
|
||||||
|
val filtered = result.data?.mapNotNull { dictBean ->
|
||||||
|
if (dictBean.code != null && dictBean.name != null) KeyValue(dictBean.name, dictBean.code) else null
|
||||||
|
} ?: emptyList()
|
||||||
|
if (filtered.size == 1) {
|
||||||
|
dataBean.value?.let { current ->
|
||||||
|
dataBean.value = current.copy(consignorCountryCode = filtered.first().value)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 目的站 → 收货人国家代码
|
||||||
|
if (manifest.fdest.isNotEmpty() && bean.consigneeCountryCode.isEmpty()) {
|
||||||
|
launchCollect({ NetApply.api.getCountryCodeListByFdep(manifest.fdest) }) {
|
||||||
|
onSuccess = { result ->
|
||||||
|
val filtered = result.data?.mapNotNull { dictBean ->
|
||||||
|
if (dictBean.code != null && dictBean.name != null) KeyValue(dictBean.name, dictBean.code) else null
|
||||||
|
} ?: emptyList()
|
||||||
|
if (filtered.size == 1) {
|
||||||
|
dataBean.value?.let { current ->
|
||||||
|
dataBean.value = current.copy(consigneeCountryCode = filtered.first().value)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -129,7 +174,7 @@ class IntArrSupplementInfoViewModel : BaseViewModel() {
|
|||||||
consignorPNum = formBean.consignorPNum,
|
consignorPNum = formBean.consignorPNum,
|
||||||
consignorAddress = formBean.consignorAddress,
|
consignorAddress = formBean.consignorAddress,
|
||||||
// 危险品信息
|
// 危险品信息
|
||||||
dgrContactMame = formBean.dgrContactMame,
|
dgrContactName = formBean.dgrContactName,
|
||||||
dgrContactNumber = formBean.dgrContactNumber,
|
dgrContactNumber = formBean.dgrContactNumber,
|
||||||
unNumber = formBean.unNumber
|
unNumber = formBean.unNumber
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -144,20 +144,19 @@ class IntImpAccidentVisaEditViewModel : BaseViewModel(), IOnItemClickListener {
|
|||||||
onSuccess = {
|
onSuccess = {
|
||||||
dataBean.value = it.data ?: GjAccidentVisaEditBean()
|
dataBean.value = it.data ?: GjAccidentVisaEditBean()
|
||||||
|
|
||||||
// 渲染图片
|
// 渲染图片:path 取原图 URL 确保预览清晰,url 取缩略图用于提交
|
||||||
val bean = dataBean.value!!
|
val bean = dataBean.value!!
|
||||||
val picList = bean.pic.split(",")
|
val picList = bean.pic.split(",").filter { it.isNotEmpty() }
|
||||||
.filter { url -> url.isNotEmpty() }
|
val originalList = bean.originalPic.split(",").filter { it.isNotEmpty() }
|
||||||
.map { url -> FileBean(MediaUtil.fillUrl(url), url) }
|
val images = picList.mapIndexed { index, picUrl ->
|
||||||
val originalList = bean.originalPic.split(",")
|
val originalUrl = originalList.getOrElse(index) { picUrl }
|
||||||
.filter { url -> url.isNotEmpty() }
|
FileBean(
|
||||||
.map { url -> FileBean(MediaUtil.fillUrl(url)) }
|
path = MediaUtil.fillUrl(originalUrl),
|
||||||
for ((index, fileBean) in picList.withIndex()) {
|
url = picUrl,
|
||||||
if (index < originalList.size) {
|
originalPic = originalUrl
|
||||||
picList[index].originalPic = originalList[index].path
|
)
|
||||||
}
|
|
||||||
}
|
}
|
||||||
rv?.commonAdapter()?.loadMore(picList)
|
rv?.commonAdapter()?.loadMore(images)
|
||||||
|
|
||||||
// 详情模式下无图片时显示占位提示
|
// 详情模式下无图片时显示占位提示
|
||||||
if (isDetailMode.value == true && picList.isEmpty()) {
|
if (isDetailMode.value == true && picList.isEmpty()) {
|
||||||
@@ -173,13 +172,23 @@ class IntImpAccidentVisaEditViewModel : BaseViewModel(), IOnItemClickListener {
|
|||||||
|
|
||||||
fun onFlightDateInputComplete() {
|
fun onFlightDateInputComplete() {
|
||||||
lastQueriedFlight = ""
|
lastQueriedFlight = ""
|
||||||
|
clearFlightInfo()
|
||||||
queryFlightIfReady()
|
queryFlightIfReady()
|
||||||
}
|
}
|
||||||
|
|
||||||
fun onFlightNoInputComplete() {
|
fun onFlightNoInputComplete() {
|
||||||
|
lastQueriedFlight = ""
|
||||||
|
clearFlightInfo()
|
||||||
queryFlightIfReady()
|
queryFlightIfReady()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun clearFlightInfo() {
|
||||||
|
val b = dataBean.value ?: GjAccidentVisaEditBean()
|
||||||
|
b.dep = ""
|
||||||
|
b.dest = ""
|
||||||
|
dataBean.value = b
|
||||||
|
}
|
||||||
|
|
||||||
private fun queryFlightIfReady() {
|
private fun queryFlightIfReady() {
|
||||||
val bean = dataBean.value ?: return
|
val bean = dataBean.value ?: return
|
||||||
val fdate = bean.fdate
|
val fdate = bean.fdate
|
||||||
@@ -228,11 +237,39 @@ class IntImpAccidentVisaEditViewModel : BaseViewModel(), IOnItemClickListener {
|
|||||||
// 保存
|
// 保存
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 校验运单号格式
|
||||||
|
* 规则:纯数字,固定11位,后8位中前7位 mod 7 == 最后一位
|
||||||
|
* 返回 true 表示校验失败(有错误)
|
||||||
|
*/
|
||||||
|
private fun verifyWaybillNo(wbNo: String?): Boolean {
|
||||||
|
if (wbNo.isNullOrEmpty()) return false
|
||||||
|
if (wbNo.length != 11) {
|
||||||
|
showToast("运单号必须为11位数字")
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
if (!wbNo.all { it.isDigit() }) {
|
||||||
|
showToast("运单号必须为纯数字")
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
val last8 = wbNo.substring(3)
|
||||||
|
val first7ofLast8 = last8.substring(0, 7).toLong()
|
||||||
|
val lastDigit = last8.last().toString().toInt()
|
||||||
|
if (first7ofLast8 % 7 != lastDigit.toLong()) {
|
||||||
|
showToast("运单号校验位不正确")
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
fun onSaveClick() {
|
fun onSaveClick() {
|
||||||
val bean = dataBean.value ?: return
|
val bean = dataBean.value ?: return
|
||||||
if (bean.fdate.verifyNullOrEmpty("请输入航班日期")) return
|
if (bean.fdate.verifyNullOrEmpty("请输入航班日期")) return
|
||||||
if (bean.fno.verifyNullOrEmpty("请输入航班号")) return
|
if (bean.fno.verifyNullOrEmpty("请输入航班号")) return
|
||||||
if (bean.wbNo.verifyNullOrEmpty("请输入运单号")) return
|
if (bean.wbNo.verifyNullOrEmpty("请输入运单号")) return
|
||||||
|
if (verifyWaybillNo(bean.wbNo)) return
|
||||||
|
if (bean.dep.verifyNullOrEmpty("请先填写航班信息(始发站不能为空)")) return
|
||||||
|
if (bean.dest.verifyNullOrEmpty("请先填写航班信息(目的站不能为空)")) return
|
||||||
|
|
||||||
(rv?.commonAdapter()?.items ?: emptyList())
|
(rv?.commonAdapter()?.items ?: emptyList())
|
||||||
.asFlow()
|
.asFlow()
|
||||||
@@ -240,8 +277,10 @@ class IntImpAccidentVisaEditViewModel : BaseViewModel(), IOnItemClickListener {
|
|||||||
.filter { it.path.isNotEmpty() && it.url.isEmpty() }
|
.filter { it.path.isNotEmpty() && it.url.isEmpty() }
|
||||||
.onEach {
|
.onEach {
|
||||||
val data = UploadUtil.upload(it.path).data
|
val data = UploadUtil.upload(it.path).data
|
||||||
it.url = data?.newName ?: ""
|
// UploadUtil 返回:newName=原图(较大),zipFileName=缩略图(较小)
|
||||||
it.originalPic = data?.zipFileName ?: ""
|
// FileBean.url 用作缩略图标识,FileBean.originalPic 用作原图标识
|
||||||
|
it.url = data?.zipFileName ?: ""
|
||||||
|
it.originalPic = data?.newName ?: ""
|
||||||
}
|
}
|
||||||
.flowOn(Dispatchers.IO)
|
.flowOn(Dispatchers.IO)
|
||||||
.onStart { showLoading() }
|
.onStart { showLoading() }
|
||||||
@@ -254,8 +293,8 @@ class IntImpAccidentVisaEditViewModel : BaseViewModel(), IOnItemClickListener {
|
|||||||
val list = (rv?.commonAdapter()?.items as List<FileBean>)
|
val list = (rv?.commonAdapter()?.items as List<FileBean>)
|
||||||
.filter { it.path.isNotEmpty() }
|
.filter { it.path.isNotEmpty() }
|
||||||
bean.picNumber = list.size.toString()
|
bean.picNumber = list.size.toString()
|
||||||
bean.originalPic = list.joinToString(separator = ",") { MediaUtil.removeUrl(it.url) }
|
bean.pic = list.joinToString(separator = ",") { MediaUtil.removeUrl(it.url) }
|
||||||
bean.pic = list.joinToString(separator = ",") { MediaUtil.removeUrl(it.originalPic) }
|
bean.originalPic = list.joinToString(separator = ",") { MediaUtil.removeUrl(it.originalPic) }
|
||||||
bean.idFlag = "1"
|
bean.idFlag = "1"
|
||||||
|
|
||||||
if (pageType.value == DetailsPageType.Add) {
|
if (pageType.value == DetailsPageType.Add) {
|
||||||
|
|||||||
@@ -37,7 +37,6 @@ class IntImpAccidentVisaViewModel : BasePageViewModel() {
|
|||||||
val wbNo = MutableLiveData("") // 运单号
|
val wbNo = MutableLiveData("") // 运单号
|
||||||
|
|
||||||
// ========== 航班查询 ==========
|
// ========== 航班查询 ==========
|
||||||
private var fid: String = ""
|
|
||||||
private var lastQueriedFlight = ""
|
private var lastQueriedFlight = ""
|
||||||
|
|
||||||
// ========== 统计信息 ==========
|
// ========== 统计信息 ==========
|
||||||
@@ -91,7 +90,6 @@ class IntImpAccidentVisaViewModel : BasePageViewModel() {
|
|||||||
onSuccess = {
|
onSuccess = {
|
||||||
if (it.verifySuccess() && it.data != null) {
|
if (it.verifySuccess() && it.data != null) {
|
||||||
val flight = it.data!!
|
val flight = it.data!!
|
||||||
fid = flight.fid.noNull()
|
|
||||||
fdest.value = flight.fdest.noNull()
|
fdest.value = flight.fdest.noNull()
|
||||||
|
|
||||||
val list = mutableListOf(
|
val list = mutableListOf(
|
||||||
@@ -103,7 +101,6 @@ class IntImpAccidentVisaViewModel : BasePageViewModel() {
|
|||||||
fdepList.value = list
|
fdepList.value = list
|
||||||
fdep.value = flight.fdep.noNull()
|
fdep.value = flight.fdep.noNull()
|
||||||
} else {
|
} else {
|
||||||
fid = ""
|
|
||||||
fdest.value = ""
|
fdest.value = ""
|
||||||
fdepList.value = emptyList()
|
fdepList.value = emptyList()
|
||||||
fdep.value = ""
|
fdep.value = ""
|
||||||
@@ -112,7 +109,6 @@ class IntImpAccidentVisaViewModel : BasePageViewModel() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
onFailed = { _, _ ->
|
onFailed = { _, _ ->
|
||||||
fid = ""
|
|
||||||
fdest.value = ""
|
fdest.value = ""
|
||||||
fdepList.value = emptyList()
|
fdepList.value = emptyList()
|
||||||
fdep.value = ""
|
fdep.value = ""
|
||||||
@@ -177,17 +173,13 @@ class IntImpAccidentVisaViewModel : BasePageViewModel() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun getData() {
|
override fun getData() {
|
||||||
val filterParams = mutableMapOf<String, Any?>(
|
val filterParams = mapOf<String, Any?>(
|
||||||
|
"fdate" to flightDate.value?.ifEmpty { null },
|
||||||
|
"fno" to flightNo.value?.ifEmpty { null },
|
||||||
"fdep" to fdep.value?.ifEmpty { null },
|
"fdep" to fdep.value?.ifEmpty { null },
|
||||||
"fdest" to fdest.value?.ifEmpty { null },
|
"fdest" to fdest.value?.ifEmpty { null },
|
||||||
"wbNo" to wbNo.value?.ifEmpty { null }
|
"wbNo" to wbNo.value?.ifEmpty { null }
|
||||||
)
|
)
|
||||||
if (fid.isNotEmpty()) {
|
|
||||||
filterParams["fid"] = fid
|
|
||||||
} else {
|
|
||||||
filterParams["fdate"] = flightDate.value?.ifEmpty { null }
|
|
||||||
filterParams["fno"] = flightNo.value?.ifEmpty { null }
|
|
||||||
}
|
|
||||||
|
|
||||||
val listParams = (filterParams + mapOf(
|
val listParams = (filterParams + mapOf(
|
||||||
"pageNum" to pageModel.page,
|
"pageNum" to pageModel.page,
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ class IntImpLoadingListEditViewModel : BaseViewModel() {
|
|||||||
val bean = Gson().fromJson(jsonData, GjjManifest::class.java)
|
val bean = Gson().fromJson(jsonData, GjjManifest::class.java)
|
||||||
dataBean.value = bean
|
dataBean.value = bean
|
||||||
// 初始化可编辑字段
|
// 初始化可编辑字段
|
||||||
location.value = bean.location
|
location.value = bean.locationTally
|
||||||
totalPcStr.value = bean.totalPc.toString()
|
totalPcStr.value = bean.totalPc.toString()
|
||||||
pcStr.value = bean.pc.toString()
|
pcStr.value = bean.pc.toString()
|
||||||
weightStr.value = bean.weight.toString()
|
weightStr.value = bean.weight.toString()
|
||||||
@@ -58,7 +58,6 @@ class IntImpLoadingListEditViewModel : BaseViewModel() {
|
|||||||
val bean = dataBean.value ?: return
|
val bean = dataBean.value ?: return
|
||||||
|
|
||||||
// 同步可编辑字段回 bean
|
// 同步可编辑字段回 bean
|
||||||
bean.location = location.value ?: ""
|
|
||||||
bean.totalPc = totalPcStr.value?.toLongOrNull() ?: 0
|
bean.totalPc = totalPcStr.value?.toLongOrNull() ?: 0
|
||||||
bean.pc = pcStr.value?.toLongOrNull() ?: 0
|
bean.pc = pcStr.value?.toLongOrNull() ?: 0
|
||||||
bean.weight = weightStr.value?.toDoubleOrNull() ?: 0.0
|
bean.weight = weightStr.value?.toDoubleOrNull() ?: 0.0
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import com.lukouguoji.gjj.activity.GjjManifestAddActivity
|
|||||||
import com.lukouguoji.gjj.activity.IntImpManifestSubEditActivity
|
import com.lukouguoji.gjj.activity.IntImpManifestSubEditActivity
|
||||||
import com.lukouguoji.gjj.holder.IntImpManifestViewHolder
|
import com.lukouguoji.gjj.holder.IntImpManifestViewHolder
|
||||||
import com.lukouguoji.module_base.base.BasePageViewModel
|
import com.lukouguoji.module_base.base.BasePageViewModel
|
||||||
|
import com.lukouguoji.module_base.bean.GjjHaWb
|
||||||
import com.lukouguoji.module_base.bean.GjjManifest
|
import com.lukouguoji.module_base.bean.GjjManifest
|
||||||
import com.lukouguoji.module_base.common.Constant
|
import com.lukouguoji.module_base.common.Constant
|
||||||
import com.lukouguoji.module_base.common.ConstantEvent
|
import com.lukouguoji.module_base.common.ConstantEvent
|
||||||
@@ -63,30 +64,40 @@ class IntImpManifestViewModel : BasePageViewModel() {
|
|||||||
lastQueriedFlight = key
|
lastQueriedFlight = key
|
||||||
|
|
||||||
launchCollect({
|
launchCollect({
|
||||||
NetApply.api.getGjFlightBean(
|
NetApply.api.searchFlightList(
|
||||||
mapOf(
|
mapOf(
|
||||||
"fdate" to fdate,
|
"fdate" to fdate,
|
||||||
"fno" to fno,
|
"fno" to fno,
|
||||||
"ieFlag" to "I",
|
"status" to "1",
|
||||||
).toRequestBody()
|
).toRequestBody()
|
||||||
)
|
)
|
||||||
}) {
|
}) {
|
||||||
onSuccess = {
|
onSuccess = {
|
||||||
if (it.verifySuccess() && it.data != null) {
|
if (it.verifySuccess() && !it.data.isNullOrEmpty()) {
|
||||||
val flight = it.data!!
|
val dataList = it.data!!
|
||||||
fid = flight.fid.noNull()
|
if (dataList.size > 1) {
|
||||||
fdep = flight.fdep.noNull()
|
showToast("存在多个航班记录,请核实")
|
||||||
fdest.value = flight.fdest.noNull()
|
fid = ""
|
||||||
|
fdep = ""
|
||||||
|
fdest.value = ""
|
||||||
|
sendAddressList.value = emptyList()
|
||||||
|
sendAddress.value = ""
|
||||||
|
} else {
|
||||||
|
val flight = dataList[0]
|
||||||
|
fid = flight.fid.noNull()
|
||||||
|
fdep = flight.fdep.noNull()
|
||||||
|
fdest.value = flight.fdest.noNull()
|
||||||
|
|
||||||
// 构建始发站下拉列表:fdep + jtz(经停港)
|
// 构建始发站下拉列表:fdep + jtz(经停港)
|
||||||
val list = mutableListOf(
|
val list = mutableListOf(
|
||||||
KeyValue(flight.fdep.noNull(), flight.fdep.noNull()),
|
KeyValue(flight.fdep.noNull(), flight.fdep.noNull()),
|
||||||
)
|
)
|
||||||
if (!flight.jtz.isNullOrEmpty()) {
|
if (!flight.jtz.isNullOrEmpty()) {
|
||||||
list.add(KeyValue(flight.jtz.noNull(), flight.jtz.noNull()))
|
list.add(KeyValue(flight.jtz.noNull(), flight.jtz.noNull()))
|
||||||
|
}
|
||||||
|
sendAddressList.value = list
|
||||||
|
sendAddress.value = flight.fdep.noNull()
|
||||||
}
|
}
|
||||||
sendAddressList.value = list
|
|
||||||
sendAddress.value = flight.fdep.noNull()
|
|
||||||
} else {
|
} else {
|
||||||
fid = ""
|
fid = ""
|
||||||
fdep = ""
|
fdep = ""
|
||||||
@@ -121,18 +132,6 @@ class IntImpManifestViewModel : BasePageViewModel() {
|
|||||||
// ========== 分单管理模式 ==========
|
// ========== 分单管理模式 ==========
|
||||||
val isSubManagementMode = MutableLiveData(false)
|
val isSubManagementMode = MutableLiveData(false)
|
||||||
|
|
||||||
init {
|
|
||||||
// 监听全选状态,自动更新所有列表项(联动子列表)
|
|
||||||
isAllChecked.observeForever { checked ->
|
|
||||||
val list = pageModel.rv?.commonAdapter()?.items as? List<GjjManifest> ?: return@observeForever
|
|
||||||
list.forEach {
|
|
||||||
it.checked.set(checked)
|
|
||||||
it.haWbList?.forEach { sub -> sub.checked.set(checked) }
|
|
||||||
}
|
|
||||||
pageModel.rv?.commonAdapter()?.notifyDataSetChanged()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// ========== 适配器配置 ==========
|
// ========== 适配器配置 ==========
|
||||||
val itemViewHolder = IntImpManifestViewHolder::class.java
|
val itemViewHolder = IntImpManifestViewHolder::class.java
|
||||||
val itemLayoutId = R.layout.item_int_imp_manifest
|
val itemLayoutId = R.layout.item_int_imp_manifest
|
||||||
@@ -144,6 +143,19 @@ class IntImpManifestViewModel : BasePageViewModel() {
|
|||||||
fun searchClick() {
|
fun searchClick() {
|
||||||
val fdate = flightDate.value
|
val fdate = flightDate.value
|
||||||
val fno = flightNo.value
|
val fno = flightNo.value
|
||||||
|
|
||||||
|
// 校验航班号必填
|
||||||
|
if (fno.isNullOrEmpty()) {
|
||||||
|
showToast("请输入航班号")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// 校验始发站、目的站是否已查询到
|
||||||
|
if (sendAddress.value.isNullOrEmpty() || fdest.value.isNullOrEmpty()) {
|
||||||
|
showToast("请先查询航班信息,获取始发站和目的站")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
if (!fdate.isNullOrEmpty() && !fno.isNullOrEmpty()) {
|
if (!fdate.isNullOrEmpty() && !fno.isNullOrEmpty()) {
|
||||||
val key = "$fdate-$fno"
|
val key = "$fdate-$fno"
|
||||||
if (key != lastQueriedFlight || fid.isEmpty()) {
|
if (key != lastQueriedFlight || fid.isEmpty()) {
|
||||||
@@ -194,10 +206,6 @@ class IntImpManifestViewModel : BasePageViewModel() {
|
|||||||
} else {
|
} else {
|
||||||
refresh()
|
refresh()
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
fid = ""
|
|
||||||
fdep = ""
|
|
||||||
refresh()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -303,7 +311,7 @@ class IntImpManifestViewModel : BasePageViewModel() {
|
|||||||
message = "确定要删除运单号 ${bean.getWaybillNo()} 的舱单吗?",
|
message = "确定要删除运单号 ${bean.getWaybillNo()} 的舱单吗?",
|
||||||
title = "提示"
|
title = "提示"
|
||||||
) {
|
) {
|
||||||
doDeleteByIds(listOf(bean.mfId))
|
doDelete(listOf(bean), emptyList())
|
||||||
}.show()
|
}.show()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -312,37 +320,67 @@ class IntImpManifestViewModel : BasePageViewModel() {
|
|||||||
*/
|
*/
|
||||||
fun onDeleteClick() {
|
fun onDeleteClick() {
|
||||||
val list = pageModel.rv?.commonAdapter()?.items as? List<GjjManifest> ?: return
|
val list = pageModel.rv?.commonAdapter()?.items as? List<GjjManifest> ?: return
|
||||||
val selectedItems = list.filter { it.isSelected }
|
|
||||||
|
|
||||||
if (selectedItems.isEmpty()) {
|
val selectedManifests = list.filter { it.isSelected }
|
||||||
|
val selectedHawbs = list.flatMap { it.haWbList?.filter { hawb -> hawb.isSelected } ?: emptyList() }
|
||||||
|
|
||||||
|
if (selectedManifests.isEmpty() && selectedHawbs.isEmpty()) {
|
||||||
showToast("请选择要删除的记录")
|
showToast("请选择要删除的记录")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 构建确认提示信息
|
||||||
|
val msgParts = mutableListOf<String>()
|
||||||
|
if (selectedManifests.isNotEmpty()) {
|
||||||
|
msgParts.add("${selectedManifests.size} 条主单")
|
||||||
|
}
|
||||||
|
if (selectedHawbs.isNotEmpty()) {
|
||||||
|
msgParts.add("${selectedHawbs.size} 条分单")
|
||||||
|
}
|
||||||
|
|
||||||
ConfirmDialogModel(
|
ConfirmDialogModel(
|
||||||
message = "确定要删除选中的 ${selectedItems.size} 条舱单吗?",
|
message = "确定要删除选中的 ${msgParts.joinToString("和")} 吗?",
|
||||||
title = "批量删除确认"
|
title = "批量删除确认"
|
||||||
) {
|
) {
|
||||||
doDeleteByIds(selectedItems.map { it.mfId })
|
doDelete(selectedManifests, selectedHawbs)
|
||||||
}.show()
|
}.show()
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 执行批量删除(统一接口,请求体为 mfId 数组)
|
* 执行删除:先删分单,再删主单(串行执行)
|
||||||
*/
|
*/
|
||||||
private fun doDeleteByIds(mfIds: List<Long>) {
|
private fun doDelete(manifests: List<GjjManifest>, hawbs: List<GjjHaWb>) {
|
||||||
launchLoadingCollect({ NetApply.api.gjjManifestDeleteBatch(mfIds.toRequestBody()) }) {
|
viewModelScope.launch {
|
||||||
onSuccess = {
|
try {
|
||||||
if (it.verifySuccess()) {
|
showLoading()
|
||||||
showToast("删除成功")
|
|
||||||
isAllChecked.value = false
|
// 第一步:删除分单(如果有选中的分单)
|
||||||
viewModelScope.launch {
|
if (hawbs.isNotEmpty()) {
|
||||||
FlowBus.with<String>(ConstantEvent.EVENT_REFRESH).emit("refresh")
|
val hawbResult = NetApply.api.intImpManifestDeleteHawb(hawbs.toRequestBody())
|
||||||
|
if (!hawbResult.verifySuccess()) {
|
||||||
|
showToast(hawbResult.msg.noNull("分单删除失败"))
|
||||||
|
refresh()
|
||||||
|
return@launch
|
||||||
}
|
}
|
||||||
refresh()
|
|
||||||
} else {
|
|
||||||
showToast(it.msg.noNull("删除失败"))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 第二步:删除主单(分单删除成功后才执行)
|
||||||
|
if (manifests.isNotEmpty()) {
|
||||||
|
val manifestResult = NetApply.api.intImpManifestDeleteManifest(manifests.toRequestBody())
|
||||||
|
if (!manifestResult.verifySuccess()) {
|
||||||
|
showToast(manifestResult.msg.noNull("分单已删除,但主单删除失败"))
|
||||||
|
refresh()
|
||||||
|
return@launch
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
showToast("删除成功")
|
||||||
|
isAllChecked.value = false
|
||||||
|
FlowBus.with<String>(ConstantEvent.EVENT_REFRESH).emit("refresh")
|
||||||
|
} catch (e: Exception) {
|
||||||
|
showToast("删除失败:${e.message}")
|
||||||
|
} finally {
|
||||||
|
dismissLoading()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package com.lukouguoji.gjj.viewModel
|
|||||||
|
|
||||||
import android.app.Activity
|
import android.app.Activity
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
|
import androidx.lifecycle.MediatorLiveData
|
||||||
import androidx.lifecycle.MutableLiveData
|
import androidx.lifecycle.MutableLiveData
|
||||||
import com.lukouguoji.gjj.R
|
import com.lukouguoji.gjj.R
|
||||||
import com.lukouguoji.gjj.activity.IntImpQueryEditActivity
|
import com.lukouguoji.gjj.activity.IntImpQueryEditActivity
|
||||||
@@ -71,6 +72,20 @@ class IntImpQueryViewModel : BasePageViewModel(), IOnItemClickListener {
|
|||||||
val businessType = MutableLiveData("")
|
val businessType = MutableLiveData("")
|
||||||
val goodsCn = MutableLiveData("")
|
val goodsCn = MutableLiveData("")
|
||||||
|
|
||||||
|
// 是否有筛选条件(任意一个非空则为 true)
|
||||||
|
val hasFilter: MediatorLiveData<Boolean> = MediatorLiveData<Boolean>().apply {
|
||||||
|
val update = { _: Any? ->
|
||||||
|
value = listOf(spCode, flightNo, origin, awbType, businessType, goodsCn)
|
||||||
|
.any { !it.value.isNullOrEmpty() }
|
||||||
|
}
|
||||||
|
addSource(spCode, update)
|
||||||
|
addSource(flightNo, update)
|
||||||
|
addSource(origin, update)
|
||||||
|
addSource(awbType, update)
|
||||||
|
addSource(businessType, update)
|
||||||
|
addSource(goodsCn, update)
|
||||||
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
// 方法区
|
// 方法区
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
|||||||
@@ -230,9 +230,13 @@ class IntImpStorageUseViewModel : BasePageViewModel() {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
val body = maWbListForInStorage.toRequestBody()
|
val body = mapOf(
|
||||||
|
"location" to locationName,
|
||||||
|
"locationId" to locationId.toLongOrNull(),
|
||||||
|
"warehouseList" to maWbListForInStorage
|
||||||
|
).toRequestBody()
|
||||||
|
|
||||||
launchLoadingCollect({ NetApply.api.inIntImpStorage(locationName, body) }) {
|
launchLoadingCollect({ NetApply.api.inIntImpStorage(body) }) {
|
||||||
onSuccess = {
|
onSuccess = {
|
||||||
showToast("入库成功")
|
showToast("入库成功")
|
||||||
viewModelScope.launch {
|
viewModelScope.launch {
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ class IntImpTallyViewModel : BasePageViewModel() {
|
|||||||
val isAllChecked = MutableLiveData(false)
|
val isAllChecked = MutableLiveData(false)
|
||||||
|
|
||||||
init {
|
init {
|
||||||
// 监听全选状态,自动更新所有列表项(联动子列表)
|
// 监听全选状态,自动更新所有列表项(主单和分单独立全选)
|
||||||
isAllChecked.observeForever { checked ->
|
isAllChecked.observeForever { checked ->
|
||||||
val list = pageModel.rv?.commonAdapter()?.items as? List<GjjImportTally> ?: return@observeForever
|
val list = pageModel.rv?.commonAdapter()?.items as? List<GjjImportTally> ?: return@observeForever
|
||||||
list.forEach {
|
list.forEach {
|
||||||
|
|||||||
5
module_gjj/src/main/res/drawable/bg_red_dot.xml
Normal file
5
module_gjj/src/main/res/drawable/bg_red_dot.xml
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:shape="oval">
|
||||||
|
<solid android:color="#F44336" />
|
||||||
|
</shape>
|
||||||
@@ -207,7 +207,7 @@
|
|||||||
<com.lukouguoji.module_base.ui.weight.data.layout.PadDataLayoutNew
|
<com.lukouguoji.module_base.ui.weight.data.layout.PadDataLayoutNew
|
||||||
android:id="@+id/actualNumInput"
|
android:id="@+id/actualNumInput"
|
||||||
hint='@{"请输入实到件数"}'
|
hint='@{"请输入实到件数"}'
|
||||||
required="@{false}"
|
required="@{true}"
|
||||||
title='@{"实到件数"}'
|
title='@{"实到件数"}'
|
||||||
titleLength="@{5}"
|
titleLength="@{5}"
|
||||||
type="@{DataLayoutType.INPUT}"
|
type="@{DataLayoutType.INPUT}"
|
||||||
@@ -242,7 +242,7 @@
|
|||||||
<com.lukouguoji.module_base.ui.weight.data.layout.PadDataLayoutNew
|
<com.lukouguoji.module_base.ui.weight.data.layout.PadDataLayoutNew
|
||||||
android:id="@+id/billingWeightInput"
|
android:id="@+id/billingWeightInput"
|
||||||
hint='@{"请输入计费重量"}'
|
hint='@{"请输入计费重量"}'
|
||||||
required="@{false}"
|
required="@{true}"
|
||||||
title='@{"计费重量"}'
|
title='@{"计费重量"}'
|
||||||
titleLength="@{5}"
|
titleLength="@{5}"
|
||||||
type="@{DataLayoutType.INPUT}"
|
type="@{DataLayoutType.INPUT}"
|
||||||
@@ -253,7 +253,7 @@
|
|||||||
|
|
||||||
<com.lukouguoji.module_base.ui.weight.data.layout.PadDataLayoutNew
|
<com.lukouguoji.module_base.ui.weight.data.layout.PadDataLayoutNew
|
||||||
hint='@{"请输入品名(中)"}'
|
hint='@{"请输入品名(中)"}'
|
||||||
required="@{false}"
|
required="@{true}"
|
||||||
title='@{"品名(中)"}'
|
title='@{"品名(中)"}'
|
||||||
titleLength="@{5}"
|
titleLength="@{5}"
|
||||||
type="@{DataLayoutType.INPUT}"
|
type="@{DataLayoutType.INPUT}"
|
||||||
|
|||||||
@@ -432,6 +432,25 @@
|
|||||||
|
|
||||||
</androidx.appcompat.widget.LinearLayoutCompat>
|
</androidx.appcompat.widget.LinearLayoutCompat>
|
||||||
|
|
||||||
|
<androidx.appcompat.widget.LinearLayoutCompat
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="20dp"
|
||||||
|
android:layout_marginRight="15dp"
|
||||||
|
android:gravity="center_vertical">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
style="@style/tv_manifest_details_label_no_mi"
|
||||||
|
android:text="交接图片:" />
|
||||||
|
|
||||||
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
|
android:id="@+id/rv_pic"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1" />
|
||||||
|
|
||||||
|
</androidx.appcompat.widget.LinearLayoutCompat>
|
||||||
|
|
||||||
<View
|
<View
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="0dp"
|
android:layout_height="0dp"
|
||||||
|
|||||||
@@ -260,7 +260,7 @@
|
|||||||
title='@{"名称"}'
|
title='@{"名称"}'
|
||||||
titleLength="@{5}"
|
titleLength="@{5}"
|
||||||
type="@{DataLayoutType.INPUT}"
|
type="@{DataLayoutType.INPUT}"
|
||||||
value='@={viewModel.dataBean.dgrContactMame}' />
|
value='@={viewModel.dataBean.dgrContactName}' />
|
||||||
|
|
||||||
<com.lukouguoji.module_base.ui.weight.data.layout.PadDataLayoutNew
|
<com.lukouguoji.module_base.ui.weight.data.layout.PadDataLayoutNew
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
|
|||||||
@@ -318,43 +318,51 @@
|
|||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
<!-- 图片区域:label 在左,图片在右 -->
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="15dp"
|
||||||
|
android:layout_marginStart="4dp"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tv_image_title"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center_vertical"
|
||||||
|
android:text='@{viewModel.isDetailMode ? "图片" : "上传图像"}'
|
||||||
|
android:textColor="@color/text_gray"
|
||||||
|
completeSpace="@{6}" />
|
||||||
|
|
||||||
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
|
android:id="@+id/rv"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:layout_marginStart="10dp"
|
||||||
|
android:overScrollMode="never"
|
||||||
|
itemLayoutId="@{viewModel.itemLayoutId}"
|
||||||
|
viewHolder="@{viewModel.itemViewHolder}"
|
||||||
|
app:layoutManager="androidx.recyclerview.widget.GridLayoutManager"
|
||||||
|
app:spanCount="9"
|
||||||
|
tools:listitem="@layout/item_image_select_new" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<!-- 详情模式下无图片时的占位提示 -->
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tv_no_image"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="60dp"
|
||||||
|
android:gravity="center"
|
||||||
|
android:text="暂无图片"
|
||||||
|
android:textColor="@color/text_gray"
|
||||||
|
android:textSize="14sp"
|
||||||
|
android:visibility="@{viewModel.showNoImage ? View.VISIBLE : View.GONE}" />
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<!-- 图像区域标题(详情模式无图片时隐藏) -->
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/tv_image_title"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginTop="15dp"
|
|
||||||
android:text='@{viewModel.isDetailMode ? "图片" : "上传图像"}'
|
|
||||||
android:textColor="@color/text_normal"
|
|
||||||
android:textSize="16sp"
|
|
||||||
android:textStyle="bold" />
|
|
||||||
|
|
||||||
<androidx.recyclerview.widget.RecyclerView
|
|
||||||
android:id="@+id/rv"
|
|
||||||
itemLayoutId="@{viewModel.itemLayoutId}"
|
|
||||||
viewHolder="@{viewModel.itemViewHolder}"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginTop="10dp"
|
|
||||||
app:layoutManager="androidx.recyclerview.widget.GridLayoutManager"
|
|
||||||
app:spanCount="6"
|
|
||||||
tools:listitem="@layout/item_image_select_new" />
|
|
||||||
|
|
||||||
<!-- 详情模式下无图片时的占位提示 -->
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/tv_no_image"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="80dp"
|
|
||||||
android:layout_marginTop="10dp"
|
|
||||||
android:background="@color/white"
|
|
||||||
android:gravity="center"
|
|
||||||
android:text="暂无图片"
|
|
||||||
android:textColor="@color/text_gray"
|
|
||||||
android:textSize="14sp"
|
|
||||||
android:visibility="@{viewModel.showNoImage ? View.VISIBLE : View.GONE}" />
|
|
||||||
|
|
||||||
<!-- 底部按钮(详情模式隐藏) -->
|
<!-- 底部按钮(详情模式隐藏) -->
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
|||||||
@@ -211,7 +211,7 @@
|
|||||||
title='@{"业务类型"}'
|
title='@{"业务类型"}'
|
||||||
titleLength="@{5}"
|
titleLength="@{5}"
|
||||||
type="@{DataLayoutType.INPUT}"
|
type="@{DataLayoutType.INPUT}"
|
||||||
value='@{viewModel.dataBean.businessType}'
|
value='@{viewModel.dataBean.businessName}'
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="1" />
|
android:layout_weight="1" />
|
||||||
@@ -263,25 +263,14 @@
|
|||||||
android:textColor="@color/text_gray"
|
android:textColor="@color/text_gray"
|
||||||
android:textSize="14sp" />
|
android:textSize="14sp" />
|
||||||
|
|
||||||
<LinearLayout
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
android:id="@+id/ll_images"
|
android:id="@+id/rv_pic"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginLeft="14dp"
|
android:layout_marginLeft="14dp"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:gravity="center_vertical"
|
|
||||||
android:minHeight="80dp"
|
android:minHeight="80dp"
|
||||||
android:orientation="horizontal">
|
android:orientation="horizontal" />
|
||||||
|
|
||||||
<!-- 交接图片区域预留,后续对接图片数据 -->
|
|
||||||
<TextView
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="暂无图片"
|
|
||||||
android:textColor="@color/text_gray"
|
|
||||||
android:textSize="12sp" />
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
xmlns:tools="http://schemas.android.com/tools">
|
xmlns:tools="http://schemas.android.com/tools">
|
||||||
|
|
||||||
<data>
|
<data>
|
||||||
|
<import type="android.view.View" />
|
||||||
<import type="com.lukouguoji.module_base.ui.weight.search.layout.SearchLayoutType" />
|
<import type="com.lukouguoji.module_base.ui.weight.search.layout.SearchLayoutType" />
|
||||||
|
|
||||||
<variable
|
<variable
|
||||||
@@ -114,13 +115,26 @@
|
|||||||
android:padding="2dp"
|
android:padding="2dp"
|
||||||
android:src="@drawable/img_search" />
|
android:src="@drawable/img_search" />
|
||||||
|
|
||||||
<ImageView
|
<FrameLayout
|
||||||
android:layout_width="36dp"
|
android:layout_width="36dp"
|
||||||
android:layout_height="36dp"
|
android:layout_height="36dp"
|
||||||
android:layout_marginLeft="16dp"
|
android:layout_marginLeft="16dp">
|
||||||
android:onClick="@{()-> viewModel.filterClick()}"
|
|
||||||
android:padding="5dp"
|
<ImageView
|
||||||
android:src="@drawable/img_filter" />
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:onClick="@{()-> viewModel.filterClick()}"
|
||||||
|
android:padding="5dp"
|
||||||
|
android:src="@drawable/img_filter" />
|
||||||
|
|
||||||
|
<View
|
||||||
|
android:layout_width="8dp"
|
||||||
|
android:layout_height="8dp"
|
||||||
|
android:layout_gravity="top|end"
|
||||||
|
android:background="@drawable/bg_red_dot"
|
||||||
|
android:visibility="@{viewModel.hasFilter ? View.VISIBLE : View.GONE}" />
|
||||||
|
|
||||||
|
</FrameLayout>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
|||||||
@@ -148,20 +148,10 @@
|
|||||||
title='@{"品名(中)"}'
|
title='@{"品名(中)"}'
|
||||||
titleLength="@{5}"
|
titleLength="@{5}"
|
||||||
type="@{DataLayoutType.INPUT}"
|
type="@{DataLayoutType.INPUT}"
|
||||||
value='@{viewModel.dataBean.goodsCn}'
|
value='@{viewModel.dataBean.goods}'
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="1" />
|
android:layout_weight="2" />
|
||||||
|
|
||||||
<com.lukouguoji.module_base.ui.weight.data.layout.PadDataLayoutNew
|
|
||||||
enable="@{false}"
|
|
||||||
title='@{"品名(英)"}'
|
|
||||||
titleLength="@{5}"
|
|
||||||
type="@{DataLayoutType.INPUT}"
|
|
||||||
value='@{viewModel.dataBean.goodsEn}'
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_weight="1" />
|
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
|||||||
@@ -83,7 +83,7 @@
|
|||||||
title='@{"运单件数"}'
|
title='@{"运单件数"}'
|
||||||
titleLength="@{5}"
|
titleLength="@{5}"
|
||||||
type="@{DataLayoutType.INPUT}"
|
type="@{DataLayoutType.INPUT}"
|
||||||
value='@{viewModel.maWbData.get("pc") != null ? String.valueOf((int)Math.round(((Double)viewModel.maWbData.get("pc")))) : ``}' />
|
value='@{viewModel.maWbData.get("awbPc") != null ? String.valueOf((int)Math.round(((Double)viewModel.maWbData.get("awbPc")))) : ``}' />
|
||||||
|
|
||||||
<com.lukouguoji.module_base.ui.weight.data.layout.PadDataLayoutNew
|
<com.lukouguoji.module_base.ui.weight.data.layout.PadDataLayoutNew
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
@@ -93,7 +93,7 @@
|
|||||||
title='@{"运单重量"}'
|
title='@{"运单重量"}'
|
||||||
titleLength="@{5}"
|
titleLength="@{5}"
|
||||||
type="@{DataLayoutType.INPUT}"
|
type="@{DataLayoutType.INPUT}"
|
||||||
value='@{viewModel.maWbData.get("weight") != null ? String.valueOf(viewModel.maWbData.get("weight")) : ``}' />
|
value='@{viewModel.maWbData.get("awbWeight") != null ? String.valueOf(viewModel.maWbData.get("awbWeight")) : ``}' />
|
||||||
|
|
||||||
<com.lukouguoji.module_base.ui.weight.data.layout.PadDataLayoutNew
|
<com.lukouguoji.module_base.ui.weight.data.layout.PadDataLayoutNew
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
|
|||||||
19
module_gjj/src/main/res/layout/item_gjj_manifest_pic.xml
Normal file
19
module_gjj/src/main/res/layout/item_gjj_manifest_pic.xml
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<layout xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
|
||||||
|
<data>
|
||||||
|
|
||||||
|
<variable
|
||||||
|
name="bean"
|
||||||
|
type="com.lukouguoji.module_base.bean.FileBean" />
|
||||||
|
|
||||||
|
</data>
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/iv_thumbnail"
|
||||||
|
android:layout_width="80dp"
|
||||||
|
android:layout_height="80dp"
|
||||||
|
android:layout_marginEnd="8dp"
|
||||||
|
android:scaleType="centerCrop" />
|
||||||
|
|
||||||
|
</layout>
|
||||||
@@ -92,7 +92,7 @@
|
|||||||
<androidx.appcompat.widget.LinearLayoutCompat
|
<androidx.appcompat.widget.LinearLayoutCompat
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="0.8"
|
android:layout_weight="0.6"
|
||||||
android:gravity="center_vertical">
|
android:gravity="center_vertical">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
@@ -114,7 +114,7 @@
|
|||||||
<androidx.appcompat.widget.LinearLayoutCompat
|
<androidx.appcompat.widget.LinearLayoutCompat
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="0.8"
|
android:layout_weight="0.6"
|
||||||
android:gravity="center_vertical">
|
android:gravity="center_vertical">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
@@ -210,7 +210,7 @@
|
|||||||
<androidx.appcompat.widget.LinearLayoutCompat
|
<androidx.appcompat.widget.LinearLayoutCompat
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="0.8"
|
android:layout_weight="0.6"
|
||||||
android:gravity="center_vertical">
|
android:gravity="center_vertical">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
@@ -232,7 +232,7 @@
|
|||||||
<androidx.appcompat.widget.LinearLayoutCompat
|
<androidx.appcompat.widget.LinearLayoutCompat
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="0.8"
|
android:layout_weight="0.6"
|
||||||
android:gravity="center_vertical">
|
android:gravity="center_vertical">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
|
|||||||
@@ -85,7 +85,7 @@
|
|||||||
<androidx.appcompat.widget.LinearLayoutCompat
|
<androidx.appcompat.widget.LinearLayoutCompat
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="0.8"
|
android:layout_weight="0.7"
|
||||||
android:gravity="center_vertical">
|
android:gravity="center_vertical">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
@@ -98,7 +98,7 @@
|
|||||||
<TextView
|
<TextView
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="@{bean.fdep}"
|
android:text="@{bean.dep}"
|
||||||
android:textSize="15sp" />
|
android:textSize="15sp" />
|
||||||
|
|
||||||
</androidx.appcompat.widget.LinearLayoutCompat>
|
</androidx.appcompat.widget.LinearLayoutCompat>
|
||||||
@@ -107,7 +107,7 @@
|
|||||||
<androidx.appcompat.widget.LinearLayoutCompat
|
<androidx.appcompat.widget.LinearLayoutCompat
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="1.2"
|
android:layout_weight="0.8"
|
||||||
android:gravity="center_vertical">
|
android:gravity="center_vertical">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
@@ -120,7 +120,7 @@
|
|||||||
<TextView
|
<TextView
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="@{String.valueOf(bean.totalPc)}"
|
android:text="@{String.valueOf(bean.pc)}"
|
||||||
android:textSize="15sp" />
|
android:textSize="15sp" />
|
||||||
|
|
||||||
</androidx.appcompat.widget.LinearLayoutCompat>
|
</androidx.appcompat.widget.LinearLayoutCompat>
|
||||||
@@ -142,7 +142,7 @@
|
|||||||
<TextView
|
<TextView
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="@{String.valueOf(bean.abnPc)}"
|
android:text="@{String.valueOf(bean.dpc)}"
|
||||||
android:textSize="15sp" />
|
android:textSize="15sp" />
|
||||||
|
|
||||||
</androidx.appcompat.widget.LinearLayoutCompat>
|
</androidx.appcompat.widget.LinearLayoutCompat>
|
||||||
@@ -205,7 +205,7 @@
|
|||||||
<androidx.appcompat.widget.LinearLayoutCompat
|
<androidx.appcompat.widget.LinearLayoutCompat
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="0.8"
|
android:layout_weight="0.7"
|
||||||
android:gravity="center_vertical">
|
android:gravity="center_vertical">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
@@ -218,7 +218,7 @@
|
|||||||
<TextView
|
<TextView
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="@{bean.fdest}"
|
android:text="@{bean.dest}"
|
||||||
android:textSize="15sp" />
|
android:textSize="15sp" />
|
||||||
|
|
||||||
</androidx.appcompat.widget.LinearLayoutCompat>
|
</androidx.appcompat.widget.LinearLayoutCompat>
|
||||||
@@ -227,7 +227,7 @@
|
|||||||
<androidx.appcompat.widget.LinearLayoutCompat
|
<androidx.appcompat.widget.LinearLayoutCompat
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="1.2"
|
android:layout_weight="0.8"
|
||||||
android:gravity="center_vertical">
|
android:gravity="center_vertical">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
@@ -240,7 +240,7 @@
|
|||||||
<TextView
|
<TextView
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="@{String.valueOf(bean.totalWeight)}"
|
android:text="@{String.valueOf(bean.weight)}"
|
||||||
android:textSize="15sp" />
|
android:textSize="15sp" />
|
||||||
|
|
||||||
</androidx.appcompat.widget.LinearLayoutCompat>
|
</androidx.appcompat.widget.LinearLayoutCompat>
|
||||||
|
|||||||
@@ -104,7 +104,7 @@
|
|||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:maxLines="1"
|
android:maxLines="1"
|
||||||
android:ellipsize="end"
|
android:ellipsize="end"
|
||||||
android:text="@{bean.lastMftStatus ?? ``}"
|
android:text="@{bean.tallyStatus ?? ``}"
|
||||||
android:textColor="@color/colorPrimary"
|
android:textColor="@color/colorPrimary"
|
||||||
android:textSize="14sp" />
|
android:textSize="14sp" />
|
||||||
|
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ import com.lukouguoji.module_base.ktx.launchLoadingCollect
|
|||||||
import com.lukouguoji.module_base.ktx.showToast
|
import com.lukouguoji.module_base.ktx.showToast
|
||||||
import com.lukouguoji.module_base.ktx.toRequestBody
|
import com.lukouguoji.module_base.ktx.toRequestBody
|
||||||
import com.lukouguoji.module_base.ktx.verifyNullOrEmpty
|
import com.lukouguoji.module_base.ktx.verifyNullOrEmpty
|
||||||
|
import com.lukouguoji.module_base.util.MediaUtil
|
||||||
import com.lukouguoji.module_base.util.UploadUtil
|
import com.lukouguoji.module_base.util.UploadUtil
|
||||||
import dev.utils.app.info.KeyValue
|
import dev.utils.app.info.KeyValue
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
@@ -71,9 +72,18 @@ class GnjYiKuEditViewModel : BaseViewModel(), IOnItemClickListener {
|
|||||||
val bean = it.data ?: GnjYiKuBean()
|
val bean = it.data ?: GnjYiKuBean()
|
||||||
dataBean.value = bean
|
dataBean.value = bean
|
||||||
|
|
||||||
// 处理图片列表
|
// 处理图片列表:pic 字段存缩略图文件名,originalPic 字段存原图文件名
|
||||||
val images = bean.getImageList().map { url ->
|
val picList = bean.pic.split(",").filter { it.isNotEmpty() }
|
||||||
FileBean(path = url)
|
val originalPicList = bean.originalPic.split(",").filter { it.isNotEmpty() }
|
||||||
|
val images = picList.mapIndexed { index, picUrl ->
|
||||||
|
val fb = FileBean(
|
||||||
|
path = MediaUtil.fillUrl(picUrl),
|
||||||
|
url = picUrl
|
||||||
|
)
|
||||||
|
if (index < originalPicList.size) {
|
||||||
|
fb.originalPic = MediaUtil.fillUrl(originalPicList[index])
|
||||||
|
}
|
||||||
|
fb
|
||||||
}.toMutableList()
|
}.toMutableList()
|
||||||
|
|
||||||
// 如果是编辑模式,添加一个空的FileBean用于添加新图片
|
// 如果是编辑模式,添加一个空的FileBean用于添加新图片
|
||||||
@@ -108,38 +118,26 @@ class GnjYiKuEditViewModel : BaseViewModel(), IOnItemClickListener {
|
|||||||
|
|
||||||
launchLoadingCollect({
|
launchLoadingCollect({
|
||||||
// 1. 上传图片
|
// 1. 上传图片
|
||||||
val uploadedUrls = mutableListOf<String>()
|
|
||||||
images.forEach { fileBean ->
|
images.forEach { fileBean ->
|
||||||
// 判断是否为已上传的图片(在线URL)
|
if (fileBean.url.isNotEmpty()) {
|
||||||
if (fileBean.path.startsWith("http")) {
|
// 已上传的图片,保持原有的 url 和 originalPic
|
||||||
uploadedUrls.add(fileBean.path)
|
|
||||||
} else {
|
} else {
|
||||||
// 本地图片需要上传
|
// 本地新图片需要上传
|
||||||
val result = UploadUtil.upload(fileBean.path)
|
// UploadUtil 返回:newName=原图(较大),zipFileName=缩略图(较小)
|
||||||
if (result.verifySuccess()) {
|
// FileBean.url 用作缩略图标识,FileBean.originalPic 用作原图标识
|
||||||
uploadedUrls.add(result.data?.newName ?: "")
|
val data = UploadUtil.upload(fileBean.path).data
|
||||||
}
|
fileBean.url = data?.zipFileName ?: ""
|
||||||
|
fileBean.originalPic = data?.newName ?: ""
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 2. 提交表单数据
|
// 2. 设置图片字段
|
||||||
val params = mapOf(
|
bean.picNumber = images.size.toString()
|
||||||
"id" to id,
|
bean.pic = images.joinToString(",") { MediaUtil.removeUrl(it.url) }
|
||||||
"wbNo" to bean.wbNo,
|
bean.originalPic = images.joinToString(",") { MediaUtil.removeUrl(it.originalPic) }
|
||||||
"pc" to bean.pc,
|
|
||||||
"weight" to bean.weight,
|
|
||||||
"spCode" to bean.spCode,
|
|
||||||
"agentCode" to bean.agentCode,
|
|
||||||
"goods" to bean.goods,
|
|
||||||
"flight" to bean.flight,
|
|
||||||
"route" to bean.route,
|
|
||||||
"awbType" to bean.awbType,
|
|
||||||
"telegramNo" to bean.telegramNo,
|
|
||||||
"remark" to bean.remark,
|
|
||||||
"images" to uploadedUrls.joinToString(","),
|
|
||||||
).toRequestBody(removeEmptyOrNull = true)
|
|
||||||
|
|
||||||
NetApply.api.saveGnjYiKu(params)
|
// 3. 提交表单数据
|
||||||
|
NetApply.api.saveGnjYiKu(bean.toRequestBody())
|
||||||
}) {
|
}) {
|
||||||
onSuccess = {
|
onSuccess = {
|
||||||
showToast(if (pageType.value == DetailsPageType.Add) "新增成功" else "保存成功")
|
showToast(if (pageType.value == DetailsPageType.Add) "新增成功" else "保存成功")
|
||||||
|
|||||||
@@ -35,6 +35,9 @@ class GnjYiKuHandoverActivity :
|
|||||||
|
|
||||||
binding.viewModel = viewModel
|
binding.viewModel = viewModel
|
||||||
|
|
||||||
|
// 绑定图片 RecyclerView 引用
|
||||||
|
viewModel.rvImages = binding.rvImages
|
||||||
|
|
||||||
// 绑定图片列表点击事件(编辑模式下可删除图片)
|
// 绑定图片列表点击事件(编辑模式下可删除图片)
|
||||||
binding.rvImages.addOnItemClickListener(viewModel)
|
binding.rvImages.addOnItemClickListener(viewModel)
|
||||||
|
|
||||||
|
|||||||
@@ -14,9 +14,12 @@ import com.lukouguoji.module_base.http.net.NetApply
|
|||||||
import com.lukouguoji.module_base.impl.FlowBus
|
import com.lukouguoji.module_base.impl.FlowBus
|
||||||
import com.lukouguoji.module_base.impl.ImageSelectNewViewHolder
|
import com.lukouguoji.module_base.impl.ImageSelectNewViewHolder
|
||||||
import com.lukouguoji.module_base.interfaces.IOnItemClickListener
|
import com.lukouguoji.module_base.interfaces.IOnItemClickListener
|
||||||
|
import com.lukouguoji.module_base.ktx.commonAdapter
|
||||||
import com.lukouguoji.module_base.ktx.launchLoadingCollect
|
import com.lukouguoji.module_base.ktx.launchLoadingCollect
|
||||||
import com.lukouguoji.module_base.ktx.showToast
|
import com.lukouguoji.module_base.ktx.showToast
|
||||||
import com.lukouguoji.module_base.ktx.toRequestBody
|
import com.lukouguoji.module_base.ktx.toRequestBody
|
||||||
|
import androidx.recyclerview.widget.RecyclerView
|
||||||
|
import com.lukouguoji.module_base.util.MediaUtil
|
||||||
import com.lukouguoji.module_base.util.UploadUtil
|
import com.lukouguoji.module_base.util.UploadUtil
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
|
|
||||||
@@ -40,6 +43,9 @@ class GnjYiKuHandoverViewModel : BaseViewModel(), IOnItemClickListener {
|
|||||||
// 详情模式下无图片时显示占位提示
|
// 详情模式下无图片时显示占位提示
|
||||||
val showNoImage = MutableLiveData(false)
|
val showNoImage = MutableLiveData(false)
|
||||||
|
|
||||||
|
// 图片 RecyclerView 引用(用于从 adapter 实时获取图片)
|
||||||
|
var rvImages: RecyclerView? = null
|
||||||
|
|
||||||
fun initOnCreated(intent: Intent) {
|
fun initOnCreated(intent: Intent) {
|
||||||
pageType.value = DetailsPageType.valueOf(
|
pageType.value = DetailsPageType.valueOf(
|
||||||
intent.getStringExtra(Constant.Key.PAGE_TYPE) ?: DetailsPageType.Modify.name
|
intent.getStringExtra(Constant.Key.PAGE_TYPE) ?: DetailsPageType.Modify.name
|
||||||
@@ -56,10 +62,23 @@ class GnjYiKuHandoverViewModel : BaseViewModel(), IOnItemClickListener {
|
|||||||
val bean = it.data ?: GnjYiKuBean()
|
val bean = it.data ?: GnjYiKuBean()
|
||||||
dataBean.value = bean
|
dataBean.value = bean
|
||||||
|
|
||||||
// 处理图片列表
|
// 处理图片列表(同时保留缩略图和原图信息,确保二次编辑时不丢失)
|
||||||
val images = bean.getImageList().map { url ->
|
val picList = bean.pic.split(",").filter { it.isNotEmpty() }
|
||||||
FileBean(path = url)
|
val originalPicList = bean.originalPic.split(",").filter { it.isNotEmpty() }
|
||||||
}.toMutableList()
|
val images = if (picList.isNotEmpty()) {
|
||||||
|
picList.mapIndexed { index, picUrl ->
|
||||||
|
val originalUrl = originalPicList.getOrElse(index) { picUrl }
|
||||||
|
FileBean(
|
||||||
|
path = MediaUtil.fillUrl(originalUrl),
|
||||||
|
url = picUrl,
|
||||||
|
originalPic = originalUrl
|
||||||
|
)
|
||||||
|
}.toMutableList()
|
||||||
|
} else {
|
||||||
|
originalPicList.map { url ->
|
||||||
|
FileBean(path = MediaUtil.fillUrl(url), url = url, originalPic = url)
|
||||||
|
}.toMutableList()
|
||||||
|
}
|
||||||
|
|
||||||
// 编辑模式添加空 FileBean 用于显示"添加照片"按钮
|
// 编辑模式添加空 FileBean 用于显示"添加照片"按钮
|
||||||
if (pageType.value == DetailsPageType.Modify) {
|
if (pageType.value == DetailsPageType.Modify) {
|
||||||
@@ -69,7 +88,7 @@ class GnjYiKuHandoverViewModel : BaseViewModel(), IOnItemClickListener {
|
|||||||
imageList.value = images
|
imageList.value = images
|
||||||
|
|
||||||
// 详情模式下无图片时显示占位提示
|
// 详情模式下无图片时显示占位提示
|
||||||
if (pageType.value == DetailsPageType.Details && bean.getImageList().isEmpty()) {
|
if (pageType.value == DetailsPageType.Details && images.isEmpty()) {
|
||||||
showNoImage.value = true
|
showNoImage.value = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -82,8 +101,10 @@ class GnjYiKuHandoverViewModel : BaseViewModel(), IOnItemClickListener {
|
|||||||
fun submit() {
|
fun submit() {
|
||||||
val bean = dataBean.value ?: return
|
val bean = dataBean.value ?: return
|
||||||
|
|
||||||
// 获取所有非空图片
|
// 从 adapter 实时获取所有非空图片(ViewHolder 新增图片直接操作 adapter items)
|
||||||
val images = imageList.value!!.filter { it.path.isNotEmpty() }
|
val allItems = (rvImages?.commonAdapter()?.items as? List<*>)
|
||||||
|
?.filterIsInstance<FileBean>() ?: imageList.value!!
|
||||||
|
val images = allItems.filter { it.path.isNotEmpty() }
|
||||||
|
|
||||||
if (images.size > 7) {
|
if (images.size > 7) {
|
||||||
showToast("最多上传7张图片")
|
showToast("最多上传7张图片")
|
||||||
@@ -92,15 +113,16 @@ class GnjYiKuHandoverViewModel : BaseViewModel(), IOnItemClickListener {
|
|||||||
|
|
||||||
launchLoadingCollect({
|
launchLoadingCollect({
|
||||||
// 上传图片
|
// 上传图片
|
||||||
val uploadedUrls = mutableListOf<String>()
|
|
||||||
images.forEach { fileBean ->
|
images.forEach { fileBean ->
|
||||||
if (fileBean.path.startsWith("http")) {
|
if (fileBean.url.isNotEmpty()) {
|
||||||
uploadedUrls.add(fileBean.path)
|
// 已上传的图片,保持原有的 url 和 originalPic
|
||||||
} else {
|
} else {
|
||||||
val result = UploadUtil.upload(fileBean.path)
|
// 本地新图片需要上传
|
||||||
if (result.verifySuccess()) {
|
// UploadUtil 返回:newName=原图(较大),zipFileName=缩略图(较小)
|
||||||
uploadedUrls.add(result.data?.newName ?: "")
|
// FileBean.url 用作缩略图标识,FileBean.originalPic 用作原图标识
|
||||||
}
|
val data = UploadUtil.upload(fileBean.path).data
|
||||||
|
fileBean.url = data?.zipFileName ?: ""
|
||||||
|
fileBean.originalPic = data?.newName ?: ""
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -108,7 +130,9 @@ class GnjYiKuHandoverViewModel : BaseViewModel(), IOnItemClickListener {
|
|||||||
val params = mapOf(
|
val params = mapOf(
|
||||||
"mawbId" to mawbId,
|
"mawbId" to mawbId,
|
||||||
"remark" to bean.remark,
|
"remark" to bean.remark,
|
||||||
"originalPic" to uploadedUrls.joinToString(","),
|
"picNumber" to images.size.toString(),
|
||||||
|
"pic" to images.joinToString(",") { MediaUtil.removeUrl(it.url) },
|
||||||
|
"originalPic" to images.joinToString(",") { MediaUtil.removeUrl(it.originalPic) },
|
||||||
).toRequestBody(removeEmptyOrNull = true)
|
).toRequestBody(removeEmptyOrNull = true)
|
||||||
|
|
||||||
NetApply.api.modifyGnjMoveStash(params)
|
NetApply.api.modifyGnjMoveStash(params)
|
||||||
@@ -127,10 +151,11 @@ class GnjYiKuHandoverViewModel : BaseViewModel(), IOnItemClickListener {
|
|||||||
* 处理图片删除点击事件
|
* 处理图片删除点击事件
|
||||||
*/
|
*/
|
||||||
override fun onItemClick(position: Int, type: Int) {
|
override fun onItemClick(position: Int, type: Int) {
|
||||||
val list = imageList.value!!
|
if (type == R.id.iv_delete) {
|
||||||
if (type == R.id.iv_delete && position < list.size) {
|
val adapter = rvImages?.commonAdapter() ?: return
|
||||||
list.removeAt(position)
|
if (position < adapter.items.size) {
|
||||||
imageList.value = list
|
adapter.removeItem(position)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,8 +26,7 @@
|
|||||||
|
|
||||||
<ScrollView
|
<ScrollView
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="0dp"
|
android:layout_height="match_parent"
|
||||||
android:layout_weight="1"
|
|
||||||
android:fillViewport="true">
|
android:fillViewport="true">
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
@@ -189,43 +188,39 @@
|
|||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
</LinearLayout>
|
<!-- 交接图片区域:label 在左,图片在右 -->
|
||||||
|
<LinearLayout
|
||||||
<!-- 交接图片区域 -->
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginTop="15dp"
|
|
||||||
android:background="@drawable/bg_white_radius_8"
|
|
||||||
android:orientation="vertical"
|
|
||||||
android:padding="15dp">
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="交接图片"
|
android:layout_marginTop="15dp"
|
||||||
android:textColor="@color/text_normal"
|
android:orientation="horizontal">
|
||||||
android:textSize="16sp"
|
|
||||||
android:textStyle="bold" />
|
|
||||||
|
|
||||||
<androidx.recyclerview.widget.RecyclerView
|
<TextView
|
||||||
android:id="@+id/rv_images"
|
android:layout_width="wrap_content"
|
||||||
android:layout_width="match_parent"
|
android:layout_height="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_gravity="center_vertical"
|
||||||
android:layout_marginTop="10dp"
|
android:text="交接图片"
|
||||||
android:overScrollMode="never"
|
android:textColor="@color/text_gray"
|
||||||
itemLayoutId="@{viewModel.imageItemLayoutId}"
|
completeSpace="@{5}" />
|
||||||
viewHolder="@{viewModel.imageItemViewHolder}"
|
|
||||||
app:layoutManager="androidx.recyclerview.widget.GridLayoutManager"
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
app:spanCount="6" />
|
android:id="@+id/rv_images"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:overScrollMode="never"
|
||||||
|
itemLayoutId="@{viewModel.imageItemLayoutId}"
|
||||||
|
viewHolder="@{viewModel.imageItemViewHolder}"
|
||||||
|
app:layoutManager="androidx.recyclerview.widget.GridLayoutManager"
|
||||||
|
app:spanCount="9" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
<!-- 详情模式下无图片时的占位提示 -->
|
<!-- 详情模式下无图片时的占位提示 -->
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/tv_no_image"
|
android:id="@+id/tv_no_image"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="80dp"
|
android:layout_height="60dp"
|
||||||
android:layout_marginTop="10dp"
|
|
||||||
android:background="@color/white"
|
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:text="暂无图片"
|
android:text="暂无图片"
|
||||||
android:textColor="@color/text_gray"
|
android:textColor="@color/text_gray"
|
||||||
@@ -234,35 +229,32 @@
|
|||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
<!-- 底部按钮(详情模式不显示) -->
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="24dp"
|
||||||
|
android:layout_marginBottom="15dp"
|
||||||
|
android:gravity="center"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:visibility="@{viewModel.pageType != DetailsPageType.Details ? View.VISIBLE : View.GONE}">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
style="@style/tv_bottom_btn"
|
||||||
|
android:layout_width="120dp"
|
||||||
|
android:onClick="@{()-> viewModel.getTopActivity().finish()}"
|
||||||
|
android:text="取消" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
style="@style/tv_bottom_btn"
|
||||||
|
android:layout_width="120dp"
|
||||||
|
android:onClick="@{()-> viewModel.submit()}"
|
||||||
|
android:text="保存" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
</ScrollView>
|
</ScrollView>
|
||||||
|
|
||||||
<!-- 底部按钮(详情模式不显示) -->
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="60dp"
|
|
||||||
android:background="@color/white"
|
|
||||||
android:gravity="center"
|
|
||||||
android:orientation="horizontal"
|
|
||||||
android:visibility="@{viewModel.pageType != DetailsPageType.Details ? View.VISIBLE : View.GONE}">
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:layout_width="150dp"
|
|
||||||
android:layout_height="50dp"
|
|
||||||
android:layout_marginRight="20dp"
|
|
||||||
android:background="@drawable/bg_gray_radius_4"
|
|
||||||
android:gravity="center"
|
|
||||||
android:onClick="@{()-> viewModel.getTopActivity().finish()}"
|
|
||||||
android:text="取消"
|
|
||||||
android:textColor="@color/white"
|
|
||||||
android:textSize="18sp" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
style="@style/tv_bottom_btn_lg"
|
|
||||||
android:onClick="@{()-> viewModel.submit()}"
|
|
||||||
android:text="保存" />
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
</layout>
|
</layout>
|
||||||
|
|||||||
@@ -30,8 +30,8 @@ import java.text.SimpleDateFormat
|
|||||||
import java.util.*
|
import java.util.*
|
||||||
|
|
||||||
|
|
||||||
|
@Deprecated("旧版航班查询,使用 HbQueryListActivity 替代")
|
||||||
// @Route(path = ARouterConstants.ACTIVITY_URL_HANG_BAN_QUERY) // 已废弃,使用 HbQueryListActivity
|
// @Route(path = ARouterConstants.ACTIVITY_URL_HANG_BAN_QUERY) // 已废弃,使用 HbQueryListActivity
|
||||||
@Deprecated("使用 HbQueryListActivity 替代")
|
|
||||||
class HangBanQueryActivity : BaseActivity(), View.OnClickListener {
|
class HangBanQueryActivity : BaseActivity(), View.OnClickListener {
|
||||||
private val currentTitleName = "航班查询"
|
private val currentTitleName = "航班查询"
|
||||||
|
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ import com.lukouguoji.module_base.BaseActivity
|
|||||||
import com.lukouguoji.module_base.common.Constant
|
import com.lukouguoji.module_base.common.Constant
|
||||||
import com.lukouguoji.module_base.router.ARouterConstants
|
import com.lukouguoji.module_base.router.ARouterConstants
|
||||||
|
|
||||||
|
@Deprecated("旧版航班查询详情,仅被废弃的 HangBanQueryActivity 调用,实际不可达")
|
||||||
@Route(path = ARouterConstants.ACTIVITY_URL_HANG_BAN_QUERY_INFO)
|
@Route(path = ARouterConstants.ACTIVITY_URL_HANG_BAN_QUERY_INFO)
|
||||||
class HangBanQueryInfoActivity : BaseActivity(), View.OnClickListener {
|
class HangBanQueryInfoActivity : BaseActivity(), View.OnClickListener {
|
||||||
private lateinit var viewModel: HangBanQueryInfoViewModel
|
private lateinit var viewModel: HangBanQueryInfoViewModel
|
||||||
|
|||||||
Reference in New Issue
Block a user