feat: 国际出港-出港装载 opt

This commit is contained in:
2026-01-07 21:27:35 +08:00
parent 2b5e0a45aa
commit 38625562ef
9 changed files with 60 additions and 45 deletions

View File

@@ -59,11 +59,6 @@ class IntExpLoadActivity :
viewModel.waybillNo.value = codedContent
viewModel.searchClick()
}
// 扫码分单号
Constant.RequestCode.CODE -> {
viewModel.houseWaybillNo.value = codedContent
viewModel.searchClick()
}
}
}
}

View File

@@ -33,7 +33,6 @@ class IntExpLoadViewModel : BasePageViewModel() {
val flightDate = MutableLiveData<String>(DateUtils.getCurrentTime().formatDate()) // 航班日期
val flightNo = MutableLiveData("") // 航班号
val waybillNo = MutableLiveData("") // 运单号
val houseWaybillNo = MutableLiveData("") // 分单号
// ========== 统计信息 ==========
val totalCount = MutableLiveData("0") // 合计票数
@@ -84,13 +83,6 @@ class IntExpLoadViewModel : BasePageViewModel() {
ScanModel.startScan(getTopActivity(), Constant.RequestCode.WAYBILL)
}
/**
* 扫码分单号
*/
fun scanHouseWaybill() {
ScanModel.startScan(getTopActivity(), Constant.RequestCode.CODE)
}
/**
* 状态重置 (批量操作)
*/
@@ -198,7 +190,6 @@ class IntExpLoadViewModel : BasePageViewModel() {
fdate = flightDate.value?.ifEmpty { null },
fno = flightNo.value?.ifEmpty { null },
no = waybillNo.value?.ifEmpty { null },
hno = houseWaybillNo.value?.ifEmpty { null },
pageNum = pageModel.page,
pageSize = pageModel.limit
)
@@ -210,8 +201,7 @@ class IntExpLoadViewModel : BasePageViewModel() {
val totalParams = GjcCheckInPage(
fdate = flightDate.value?.ifEmpty { null },
fno = flightNo.value?.ifEmpty { null },
no = waybillNo.value?.ifEmpty { null },
hno = houseWaybillNo.value?.ifEmpty { null }
no = waybillNo.value?.ifEmpty { null }
).toRequestBody()
// 获取列表 (带Loading)

View File

@@ -42,6 +42,14 @@ class IntExpTallyViewModel : BasePageViewModel() {
// ========== 全选状态 ==========
val isAllChecked = MutableLiveData(false)
// ========== 全局展开状态 ==========
/**
* 全局展开状态
* - true: 全部展开
* - false: 全部收起
*/
val isAllExpanded = MutableLiveData(false)
init {
// 监听全选状态,自动更新所有列表项
isAllChecked.observeForever { checked ->
@@ -76,6 +84,28 @@ class IntExpTallyViewModel : BasePageViewModel() {
pageModel.rv?.commonAdapter()?.notifyDataSetChanged()
}
/**
* 切换全局展开/收起状态
*/
fun toggleAllExpand() {
val list = pageModel.rv?.commonAdapter()?.items as? List<GjcMaWb> ?: return
// 切换全局状态
val shouldExpand = !isAllExpanded.value!!
isAllExpanded.value = shouldExpand
// 更新所有列表项的 showMore 状态
list.forEach { bean ->
// 只有当有子列表时才设置展开状态
if (!bean.haWbList.isNullOrEmpty()) {
bean.showMore.set(shouldExpand)
}
}
// 刷新列表UI
pageModel.rv?.commonAdapter()?.notifyDataSetChanged()
}
/**
* 扫码运单号
*/
@@ -213,7 +243,11 @@ class IntExpTallyViewModel : BasePageViewModel() {
// 获取列表 (带Loading)
launchLoadingCollect({ NetApply.api.getIntExpTallyList(listParams) }) {
onSuccess = { pageModel.handleListBean(it) }
onSuccess = {
pageModel.handleListBean(it)
// 数据加载完成后,重置全局展开状态为收起
isAllExpanded.value = false
}
}
// 获取统计信息 (后台请求,不阻塞列表)

View File

@@ -61,17 +61,6 @@
type="@{SearchLayoutType.INPUT}"
value="@={viewModel.waybillNo}" />
<!-- 分单号 -->
<com.lukouguoji.module_base.ui.weight.search.layout.PadSearchLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
hint='@{"请输入分单号"}'
icon="@{@drawable/img_scan}"
setOnIconClickListener="@{(v)-> viewModel.scanHouseWaybill()}"
type="@{SearchLayoutType.INPUT}"
value="@={viewModel.houseWaybillNo}" />
<!-- 搜索按钮 -->
<LinearLayout
android:layout_width="0dp"

View File

@@ -7,6 +7,8 @@
<import type="com.lukouguoji.module_base.ui.weight.search.layout.SearchLayoutType" />
<import type="com.lukouguoji.gjc.R" />
<variable
name="viewModel"
type="com.lukouguoji.gjc.viewModel.IntExpTallyViewModel" />
@@ -88,6 +90,17 @@
android:padding="2dp"
android:src="@drawable/img_search" />
<!-- 全局展开/收起按钮 -->
<ImageView
android:layout_width="36dp"
android:layout_height="36dp"
android:layout_marginStart="8dp"
android:onClick="@{()-> viewModel.toggleAllExpand()}"
android:padding="2dp"
android:scaleType="fitCenter"
loadImage="@{viewModel.isAllExpanded ? R.mipmap.img_up : R.mipmap.img_down}"
android:contentDescription="展开/收起全部子列表" />
</LinearLayout>
</LinearLayout>

View File

@@ -93,8 +93,8 @@
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@{bean.getLoadStatusText()}"
android:textColor="@color/text_red"
android:text="@{bean.loadStatus}"
android:textColor="@color/text_normal"
android:textSize="16sp" />
</LinearLayout>

View File

@@ -74,7 +74,15 @@
</LinearLayout>
</LinearLayout>
<!-- 展开/折叠按钮 -->
<ImageView android:id="@+id/iv_show" android:layout_width="match_parent" android:layout_height="20dp" android:layout_marginTop="5dp" android:layout_marginBottom="5dp" android:padding="5dp" android:src="@mipmap/img_down"/>
<ImageView
android:id="@+id/iv_show"
android:layout_width="match_parent"
android:layout_height="20dp"
android:layout_marginTop="5dp"
android:layout_marginBottom="5dp"
android:padding="5dp"
android:src="@mipmap/img_down"
visible="@{bean.haWbList != null &amp;&amp; !bean.haWbList.empty}" />
</LinearLayout>
<!-- 子订单列表容器(在白色卡片外面) -->
<LinearLayout visible="@{bean.showMore}" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginTop="5dp" android:background="#e3f6e0" android:orientation="vertical" android:visibility="gone">