feat: 国际出港 出港仓库 清仓

This commit is contained in:
2026-01-15 17:23:48 +08:00
parent 0a506617c7
commit a8d125ef9d
6 changed files with 38 additions and 17 deletions

2
.vfox.toml Normal file
View File

@@ -0,0 +1,2 @@
[tools]
java = "17.0.16+8-amzn"

1
.vfox/sdks/java Symbolic link
View File

@@ -0,0 +1 @@
/Users/kid/.version-fox/cache/java/v-17.0.16+8-amzn/java-17.0.16+8-amzn

View File

@@ -63,12 +63,11 @@ class IntExpStorageUseActivity :
val selectedStorageList = maWb.storageUseList?.filter { it.isSelected } ?: emptyList()
// 只添加有选中子列表项的主列表项
if (selectedStorageList.isNotEmpty()) {
if (selectedStorageList.isNotEmpty() || maWb.isSelected) {
// 创建主列表项的副本,只包含选中的子列表
maWb.copy(storageUseList = selectedStorageList)
} else {
// null
maWb
null
}
}

View File

@@ -26,26 +26,26 @@ class IntExpStorageUseSubViewHolder(view: View) :
bean.checked.set(newCheckedState)
binding.executePendingBindings()
// 反向联动主列表项
updateParentCheckState()
// 反向联动主列表项(仅在勾选时联动)
updateParentCheckState(newCheckedState)
}
}
/**
* 更新父列表项的选择状态
* 规则:
* - 如果有任何一个子列表项被勾选,则主列表项也应该被勾选
* - 如果所有子列表项都未勾选,则主列表项也应该取消勾选
* - 如果子项被勾选newCheckedState = true则自动勾选父项
* - 如果子项被取消勾选newCheckedState = false则不改变父项状态
*/
private fun updateParentCheckState() {
private fun updateParentCheckState(newCheckedState: Boolean) {
// 从RecyclerView的tag获取父Bean引用
val recyclerView = itemView.parent as? RecyclerView ?: return
val parentBean = recyclerView.tag as? GjcMaWb ?: return
// 检查是否有任何一个子列表项被勾选
val hasAnyChecked = parentBean.storageUseList?.any { it.checked.get() } ?: false
// 更新父列表项的选择状态
parentBean.checked.set(hasAnyChecked)
// 只有当子项被勾选时,才联动勾选父项
if (newCheckedState) {
parentBean.checked.set(true)
}
// 当子项被取消勾选时,不影响父项状态
}
}

View File

@@ -20,10 +20,20 @@ class IntExpTallyViewHolder(view: View) :
binding.position = position
binding.executePendingBindings()
// 图标点击切换选择状态(保留原有
// 图标点击切换选择状态(单向同步到子列表
binding.ivIcon.setOnClickListener {
bean.checked.set(!bean.checked.get())
// 切换主列表项的选择状态
val newCheckedState = !bean.checked.get()
bean.checked.set(newCheckedState)
// 单向同步:主列表选择状态同步到所有子列表项
bean.haWbList?.forEach { haWb ->
haWb.checked.set(newCheckedState)
}
// 刷新UI
binding.executePendingBindings()
binding.rvSub.adapter?.notifyDataSetChanged()
}
// ========== 新增:展开按钮点击事件 ==========

View File

@@ -71,14 +71,23 @@ class IntExpTallyViewModel : BasePageViewModel() {
}
/**
* 全选按钮点击 (切换全选状态)
* 全选按钮点击 (切换全选状态,单向同步到子列表)
*/
fun checkAllClick() {
val list = pageModel.rv?.commonAdapter()?.items as? List<GjcMaWb> ?: return
// 切换全选状态
val shouldCheckAll = !isAllChecked.value!!
list.forEach { it.checked.set(shouldCheckAll) }
// 单向同步:主列表和子列表都设置为相同的选择状态
list.forEach { maWb ->
maWb.checked.set(shouldCheckAll)
// 同步到所有子列表项
maWb.haWbList?.forEach { haWb ->
haWb.checked.set(shouldCheckAll)
}
}
isAllChecked.value = shouldCheckAll
pageModel.rv?.commonAdapter()?.notifyDataSetChanged()