refactor: 国际进港4页面标准化及始发站筛选控件优化

- 统一 getData() 使用 handleListBean 替代手动分页处理
- 底部栏背景色统一为 @color/white
- 进港舱单删除弹窗改用 ConfirmDialogModel
- 进港舱单新增始发站 SPINNER 筛选控件
- 电报解析始发站和报文类型改为 SPINNER 下拉选择

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-05 13:17:13 +08:00
parent c0025c949f
commit e50ce25eb3
6 changed files with 46 additions and 68 deletions

View File

@@ -267,19 +267,7 @@ class IntArrAirManifestViewModel : BasePageViewModel() {
// 获取列表带Loading // 获取列表带Loading
launchLoadingCollect({ NetApply.api.getIntArrAirManifestList(listParams) }) { launchLoadingCollect({ NetApply.api.getIntArrAirManifestList(listParams) }) {
onSuccess = { result -> onSuccess = { result ->
// 处理PageInfo结构 pageModel.handleListBean(result.data?.toBaseListBean())
val pageInfo = result.data
if (pageInfo != null) {
val list = pageInfo.list ?: emptyList()
val pages = pageInfo.pages ?: 1
// 处理分页数据
pageModel.handleDataList(list)
pageModel.haveMore.postValue(pages > pageModel.page)
} else {
pageModel.handleDataList(emptyList())
pageModel.haveMore.postValue(false)
}
} }
} }

View File

@@ -1,7 +1,5 @@
package com.lukouguoji.gjj.viewModel package com.lukouguoji.gjj.viewModel
import android.app.Activity
import androidx.appcompat.app.AlertDialog
import androidx.lifecycle.MutableLiveData import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.viewModelScope import androidx.lifecycle.viewModelScope
import com.lukouguoji.gjj.R import com.lukouguoji.gjj.R
@@ -21,6 +19,8 @@ import com.lukouguoji.module_base.ktx.launchLoadingCollect
import com.lukouguoji.module_base.ktx.noNull import com.lukouguoji.module_base.ktx.noNull
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.model.ConfirmDialogModel
import dev.utils.app.info.KeyValue
import com.lukouguoji.module_base.model.ScanModel import com.lukouguoji.module_base.model.ScanModel
import kotlinx.coroutines.launch import kotlinx.coroutines.launch
@@ -32,7 +32,9 @@ class IntImpManifestViewModel : BasePageViewModel() {
// ========== 搜索条件 ========== // ========== 搜索条件 ==========
val flightDate = MutableLiveData<String>(DateUtils.getCurrentTime().formatDate()) // 航班日期 val flightDate = MutableLiveData<String>(DateUtils.getCurrentTime().formatDate()) // 航班日期
val flightNo = MutableLiveData("") // 航班号 val flightNo = MutableLiveData("") // 航班号
val fdep = MutableLiveData("") // 始发站 val sendAddress = MutableLiveData("") // 始发站
val sendAddressList = MutableLiveData<List<KeyValue>>(emptyList())
val fdep = MutableLiveData("") // 目的站
val waybillNo = MutableLiveData("") // 运单号 val waybillNo = MutableLiveData("") // 运单号
// ========== 统计信息 ========== // ========== 统计信息 ==========
@@ -129,10 +131,10 @@ class IntImpManifestViewModel : BasePageViewModel() {
* 删除单个舱单 * 删除单个舱单
*/ */
private fun deleteManifest(bean: GjjManifest) { private fun deleteManifest(bean: GjjManifest) {
AlertDialog.Builder(getTopActivity()) ConfirmDialogModel(
.setTitle("提示") message = "确定要删除运单号 ${bean.getWaybillNo()} 的舱单吗?",
.setMessage("确定要删除运单号 ${bean.getWaybillNo()} 的舱单吗?") title = "提示"
.setPositiveButton("确定") { _, _ -> ) {
val params = mapOf("mfId" to bean.mfId).toRequestBody() val params = mapOf("mfId" to bean.mfId).toRequestBody()
launchLoadingCollect({ NetApply.api.gjjManifestDelete(params) }) { launchLoadingCollect({ NetApply.api.gjjManifestDelete(params) }) {
@@ -148,9 +150,7 @@ class IntImpManifestViewModel : BasePageViewModel() {
} }
} }
} }
} }.show()
.setNegativeButton("取消", null)
.show()
} }
/** /**
@@ -199,6 +199,7 @@ class IntImpManifestViewModel : BasePageViewModel() {
val filterParams = mapOf( val filterParams = mapOf(
"fdate" to flightDate.value?.ifEmpty { null }, "fdate" to flightDate.value?.ifEmpty { null },
"fno" to flightNo.value?.ifEmpty { null }, "fno" to flightNo.value?.ifEmpty { null },
"sendAddress" to sendAddress.value?.ifEmpty { null },
"fdep" to fdep.value?.ifEmpty { null }, "fdep" to fdep.value?.ifEmpty { null },
"wbNo" to waybillNo.value?.ifEmpty { null } "wbNo" to waybillNo.value?.ifEmpty { null }
) )
@@ -215,19 +216,7 @@ class IntImpManifestViewModel : BasePageViewModel() {
// 获取列表带Loading // 获取列表带Loading
launchLoadingCollect({ NetApply.api.getIntImpManifestList(listParams) }) { launchLoadingCollect({ NetApply.api.getIntImpManifestList(listParams) }) {
onSuccess = { result -> onSuccess = { result ->
// 处理PageInfo结构 pageModel.handleListBean(result.data?.toBaseListBean())
val pageInfo = result.data
if (pageInfo != null) {
val list = pageInfo.list ?: emptyList()
val pages = pageInfo.pages ?: 1
// 处理分页数据
pageModel.handleDataList(list)
pageModel.haveMore.postValue(pages > pageModel.page)
} else {
pageModel.handleDataList(emptyList())
pageModel.haveMore.postValue(false)
}
} }
} }

View File

@@ -15,6 +15,7 @@ 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 dev.utils.app.info.KeyValue
import kotlinx.coroutines.launch import kotlinx.coroutines.launch
/** /**
@@ -26,8 +27,10 @@ class IntImpMsgParseViewModel : BasePageViewModel() {
val flightDate = MutableLiveData<String>(DateUtils.getCurrentTime().formatDate()) // 航班日期 val flightDate = MutableLiveData<String>(DateUtils.getCurrentTime().formatDate()) // 航班日期
val flightNo = MutableLiveData("") // 航班号 val flightNo = MutableLiveData("") // 航班号
val sendAddress = MutableLiveData("") // 发站(择始发站) val sendAddress = MutableLiveData("") // 发站(择始发站)
val sendAddressList = MutableLiveData<List<KeyValue>>(emptyList())
val receiveAddress = MutableLiveData("HFE") // 收报地址(目的站) val receiveAddress = MutableLiveData("HFE") // 收报地址(目的站)
val msgType = MutableLiveData("") // 报文类型 val msgType = MutableLiveData("") // 报文类型
val msgTypeList = MutableLiveData<List<KeyValue>>(emptyList())
// ========== 统计信息 ========== // ========== 统计信息 ==========
val totalCount = MutableLiveData("0") // 合计条数 val totalCount = MutableLiveData("0") // 合计条数
@@ -117,23 +120,9 @@ class IntImpMsgParseViewModel : BasePageViewModel() {
// 获取列表带Loading // 获取列表带Loading
launchLoadingCollect({ NetApply.api.getIntImpMsgList(listParams) }) { launchLoadingCollect({ NetApply.api.getIntImpMsgList(listParams) }) {
onSuccess = { result -> onSuccess = { result ->
// 处理PageInfo结构
val pageInfo = result.data val pageInfo = result.data
if (pageInfo != null) { pageModel.handleListBean(pageInfo?.toBaseListBean())
val list = pageInfo.list ?: emptyList() totalCount.value = (pageInfo?.total ?: 0).toString()
val pages = pageInfo.pages ?: 1
// 更新统计信息
totalCount.value = (pageInfo.total ?: 0).toString()
// 处理分页数据
pageModel.handleDataList(list)
pageModel.haveMore.postValue(pages > pageModel.page)
} else {
pageModel.handleDataList(emptyList())
pageModel.haveMore.postValue(false)
totalCount.value = "0"
}
} }
} }
} }

View File

@@ -115,7 +115,7 @@
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="50dp" android:layout_height="50dp"
android:background="@android:color/white" android:background="@color/white"
android:gravity="center_vertical" android:gravity="center_vertical"
android:paddingHorizontal="15dp"> android:paddingHorizontal="15dp">

View File

@@ -50,6 +50,16 @@
android:layout_weight="1" /> android:layout_weight="1" />
<!-- 始发站 --> <!-- 始发站 -->
<com.lukouguoji.module_base.ui.weight.search.layout.PadSearchLayout
hint='@{"请选择始发站"}'
type="@{SearchLayoutType.SPINNER}"
list="@{viewModel.sendAddressList}"
value="@={viewModel.sendAddress}"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1" />
<!-- 目的站固定HFE -->
<com.lukouguoji.module_base.ui.weight.search.layout.PadSearchLayout <com.lukouguoji.module_base.ui.weight.search.layout.PadSearchLayout
hint='@{"HFE"}' hint='@{"HFE"}'
type="@{SearchLayoutType.INPUT}" type="@{SearchLayoutType.INPUT}"

View File

@@ -52,7 +52,8 @@
<!-- 择始发站 --> <!-- 择始发站 -->
<com.lukouguoji.module_base.ui.weight.search.layout.PadSearchLayout <com.lukouguoji.module_base.ui.weight.search.layout.PadSearchLayout
hint='@{"请选择始发站"}' hint='@{"请选择始发站"}'
type="@{SearchLayoutType.INPUT}" type="@{SearchLayoutType.SPINNER}"
list="@{viewModel.sendAddressList}"
value="@={viewModel.sendAddress}" value="@={viewModel.sendAddress}"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@@ -70,7 +71,8 @@
<!-- 报文类型 --> <!-- 报文类型 -->
<com.lukouguoji.module_base.ui.weight.search.layout.PadSearchLayout <com.lukouguoji.module_base.ui.weight.search.layout.PadSearchLayout
hint='@{"请选择报文类型"}' hint='@{"请选择报文类型"}'
type="@{SearchLayoutType.INPUT}" type="@{SearchLayoutType.SPINNER}"
list="@{viewModel.msgTypeList}"
value="@={viewModel.msgType}" value="@={viewModel.msgType}"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@@ -123,7 +125,7 @@
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="50dp" android:layout_height="50dp"
android:background="@android:color/white" android:background="@color/white"
android:gravity="center_vertical" android:gravity="center_vertical"
android:paddingHorizontal="15dp"> android:paddingHorizontal="15dp">