feat: 国际出港 出港仓库
This commit is contained in:
@@ -42,6 +42,14 @@ class IntExpStorageUseViewModel : BasePageViewModel() {
|
||||
// ========== 全选状态 ==========
|
||||
val isAllChecked = MutableLiveData(false)
|
||||
|
||||
// ========== 全局展开状态 ==========
|
||||
/**
|
||||
* 全局展开状态
|
||||
* - true: 全部展开
|
||||
* - false: 全部收起
|
||||
*/
|
||||
val isAllExpanded = MutableLiveData(false)
|
||||
|
||||
init {
|
||||
// 初始化清仓综合结果列表(根据实际需求配置)
|
||||
clearResultList.value = listOf(
|
||||
@@ -82,6 +90,28 @@ class IntExpStorageUseViewModel : 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.storageUseList.isNullOrEmpty()) {
|
||||
bean.showMore.set(shouldExpand)
|
||||
}
|
||||
}
|
||||
|
||||
// 刷新列表UI
|
||||
pageModel.rv?.commonAdapter()?.notifyDataSetChanged()
|
||||
}
|
||||
|
||||
/**
|
||||
* 扫码运单号
|
||||
*/
|
||||
@@ -180,6 +210,8 @@ class IntExpStorageUseViewModel : BasePageViewModel() {
|
||||
// 手动处理 PageInfo 数据
|
||||
pageModel.handleDataList(result.list)
|
||||
pageModel.haveMore.postValue((result.pages) > pageModel.page)
|
||||
// 数据加载完成后,重置全局展开状态为收起
|
||||
isAllExpanded.value = false
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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.IntExpStorageUseViewModel" />
|
||||
@@ -87,7 +89,7 @@
|
||||
|
||||
<!-- 搜索按钮 -->
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_width="200dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal"
|
||||
@@ -100,6 +102,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>
|
||||
|
||||
@@ -156,7 +156,7 @@
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="0.7"
|
||||
android:layout_weight="0.6"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
@@ -275,7 +275,7 @@
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="0.7"
|
||||
android:layout_weight="0.6"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
|
||||
@@ -59,7 +59,7 @@
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_weight="1.5"
|
||||
android:gravity="center"
|
||||
android:text="@{bean.inDate != null ? bean.inDate.toString() : ``}"
|
||||
android:text="@{bean.inDate ?? ``}"
|
||||
android:textColor="@color/text_normal"
|
||||
android:textSize="14sp" />
|
||||
|
||||
@@ -81,7 +81,7 @@
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_weight="1.5"
|
||||
android:gravity="center"
|
||||
android:text="@{bean.outDate != null ? bean.outDate.toString() : ``}"
|
||||
android:text="@{bean.outDate ?? ``}"
|
||||
android:textColor="@color/text_normal"
|
||||
android:textSize="14sp" />
|
||||
|
||||
|
||||
Reference in New Issue
Block a user