refactor: 国际进港原始舱单主子列表改为独立选择

移除主单↔分单勾选联动,改为独立选择模式;
提取公共方法 getSelectedItems() 分别收集选中的主单和分单;
补充信息操作仅校验主单选中状态;详情页品名字段增加中文品名回退逻辑。

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-09 11:33:20 +08:00
parent 76f55597db
commit af49cf4fb6
4 changed files with 31 additions and 89 deletions

View File

@@ -1,10 +1,8 @@
package com.lukouguoji.gjj.holder
import android.view.View
import androidx.recyclerview.widget.RecyclerView
import com.lukouguoji.gjj.databinding.ItemIntArrAirManifestSubBinding
import com.lukouguoji.module_base.base.BaseViewHolder
import com.lukouguoji.module_base.bean.GjjAirManifest
import com.lukouguoji.module_base.bean.GjjImportManifest
/**
@@ -19,18 +17,10 @@ class IntArrAirManifestSubViewHolder(view: View) :
binding.position = position
binding.executePendingBindings()
// 单选框点击切换选择状态
// 单选框点击切换选择状态(独立选择,不联动主列表)
binding.ivCheckbox.setOnClickListener {
val newCheckedState = !bean.checked.get()
bean.checked.set(newCheckedState)
bean.checked.set(!bean.checked.get())
binding.executePendingBindings()
// 反向联动主列表项(勾选子项时自动勾选父项)
if (newCheckedState) {
val recyclerView = itemView.parent as? RecyclerView ?: return@setOnClickListener
val parentBean = recyclerView.tag as? GjjAirManifest ?: return@setOnClickListener
parentBean.checked.set(true)
}
}
}
}

View File

@@ -26,14 +26,10 @@ class IntArrAirManifestViewHolder(view: View) :
// 整卡点击 - 跳转详情页
notifyItemClick(position, binding.ll)
// 图标点击 - 切换选择状态(联动子列表)
// 图标点击 - 切换选择状态(独立选择,不联动子列表)
binding.ivIcon.setOnClickListener {
val newCheckedState = !bean.checked.get()
bean.checked.set(newCheckedState)
// 联动子列表选中状态
bean.haWbList?.forEach { sub -> sub.checked.set(newCheckedState) }
bean.checked.set(!bean.checked.get())
binding.executePendingBindings()
binding.rvSub.adapter?.notifyDataSetChanged()
}
// 展开按钮点击事件
@@ -48,7 +44,6 @@ class IntArrAirManifestViewHolder(view: View) :
R.layout.item_int_arr_air_manifest_sub
)
// 设置父Bean引用(用于子列表反向联动)
binding.rvSub.tag = bean
binding.rvSub.refresh(bean.haWbList ?: emptyList())
}