fix: 事故签证列表查询改用 fdate+fno,理货主分单取消联动选择

- IntImpAccidentVisaViewModel: 移除 fid 逻辑,始终使用 fdate+fno+fdep+fdest 查询
- IntImpTallyViewHolder/SubViewHolder: 主单与分单选择状态改为独立,不再互相联动

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-04-15 12:00:18 +08:00
parent 27d6e55cbe
commit faf343301f
4 changed files with 8 additions and 41 deletions

View File

@@ -1,7 +1,6 @@
package com.lukouguoji.gjj.holder package com.lukouguoji.gjj.holder
import android.view.View import android.view.View
import androidx.recyclerview.widget.RecyclerView
import com.lukouguoji.gjj.databinding.ItemIntImpTallySubBinding import com.lukouguoji.gjj.databinding.ItemIntImpTallySubBinding
import com.lukouguoji.module_base.base.BaseViewHolder import com.lukouguoji.module_base.base.BaseViewHolder
import com.lukouguoji.module_base.bean.GjjImportTally import com.lukouguoji.module_base.bean.GjjImportTally
@@ -18,26 +17,10 @@ class IntImpTallySubViewHolder(view: View) :
binding.position = position binding.position = position
binding.executePendingBindings() binding.executePendingBindings()
// 单选框点击切换选择状态(反向联动主列表 // 单选框点击切换选择状态(独立选择,不联动主
binding.ivCheckbox.setOnClickListener { binding.ivCheckbox.setOnClickListener {
val newCheckedState = !bean.checked.get() bean.checked.set(!bean.checked.get())
bean.checked.set(newCheckedState)
binding.executePendingBindings() binding.executePendingBindings()
// 反向联动主列表项(勾选时联动主项也勾选)
updateParentCheckState(newCheckedState)
}
}
/**
* 更新父列表项的选择状态
*/
private fun updateParentCheckState(newCheckedState: Boolean) {
val recyclerView = itemView.parent as? RecyclerView ?: return
val parentBean = recyclerView.tag as? GjjImportTally ?: return
if (newCheckedState) {
parentBean.checked.set(true)
} }
} }
} }

View File

@@ -25,18 +25,10 @@ class IntImpTallyViewHolder(view: View) :
binding.position = position binding.position = position
binding.executePendingBindings() binding.executePendingBindings()
// 选中图标点击 - 切换选择状态(联动子列表 // 选中图标点击 - 切换选择状态(独立选择,不联动分单
binding.ivIcon.setOnClickListener { binding.ivIcon.setOnClickListener {
val newCheckedState = !bean.checked.get() bean.checked.set(!bean.checked.get())
bean.checked.set(newCheckedState)
// 联动勾选/取消所有子列表项
bean.haWbList?.forEach { sub ->
sub.checked.set(newCheckedState)
}
binding.executePendingBindings() binding.executePendingBindings()
binding.rvSub.adapter?.notifyDataSetChanged()
} }
// 整个内容区域点击 - 跳转到详情页 // 整个内容区域点击 - 跳转到详情页

View File

@@ -37,7 +37,6 @@ class IntImpAccidentVisaViewModel : BasePageViewModel() {
val wbNo = MutableLiveData("") // 运单号 val wbNo = MutableLiveData("") // 运单号
// ========== 航班查询 ========== // ========== 航班查询 ==========
private var fid: String = ""
private var lastQueriedFlight = "" private var lastQueriedFlight = ""
// ========== 统计信息 ========== // ========== 统计信息 ==========
@@ -91,7 +90,6 @@ class IntImpAccidentVisaViewModel : BasePageViewModel() {
onSuccess = { onSuccess = {
if (it.verifySuccess() && it.data != null) { if (it.verifySuccess() && it.data != null) {
val flight = it.data!! val flight = it.data!!
fid = flight.fid.noNull()
fdest.value = flight.fdest.noNull() fdest.value = flight.fdest.noNull()
val list = mutableListOf( val list = mutableListOf(
@@ -103,7 +101,6 @@ class IntImpAccidentVisaViewModel : BasePageViewModel() {
fdepList.value = list fdepList.value = list
fdep.value = flight.fdep.noNull() fdep.value = flight.fdep.noNull()
} else { } else {
fid = ""
fdest.value = "" fdest.value = ""
fdepList.value = emptyList() fdepList.value = emptyList()
fdep.value = "" fdep.value = ""
@@ -112,7 +109,6 @@ class IntImpAccidentVisaViewModel : BasePageViewModel() {
} }
onFailed = { _, _ -> onFailed = { _, _ ->
fid = ""
fdest.value = "" fdest.value = ""
fdepList.value = emptyList() fdepList.value = emptyList()
fdep.value = "" fdep.value = ""
@@ -177,17 +173,13 @@ class IntImpAccidentVisaViewModel : BasePageViewModel() {
} }
override fun getData() { override fun getData() {
val filterParams = mutableMapOf<String, Any?>( val filterParams = mapOf<String, Any?>(
"fdate" to flightDate.value?.ifEmpty { null },
"fno" to flightNo.value?.ifEmpty { null },
"fdep" to fdep.value?.ifEmpty { null }, "fdep" to fdep.value?.ifEmpty { null },
"fdest" to fdest.value?.ifEmpty { null }, "fdest" to fdest.value?.ifEmpty { null },
"wbNo" to wbNo.value?.ifEmpty { null } "wbNo" to wbNo.value?.ifEmpty { null }
) )
if (fid.isNotEmpty()) {
filterParams["fid"] = fid
} else {
filterParams["fdate"] = flightDate.value?.ifEmpty { null }
filterParams["fno"] = flightNo.value?.ifEmpty { null }
}
val listParams = (filterParams + mapOf( val listParams = (filterParams + mapOf(
"pageNum" to pageModel.page, "pageNum" to pageModel.page,

View File

@@ -43,7 +43,7 @@ class IntImpTallyViewModel : BasePageViewModel() {
val isAllChecked = MutableLiveData(false) val isAllChecked = MutableLiveData(false)
init { init {
// 监听全选状态,自动更新所有列表项(联动子列表 // 监听全选状态,自动更新所有列表项(主单和分单独立全选
isAllChecked.observeForever { checked -> isAllChecked.observeForever { checked ->
val list = pageModel.rv?.commonAdapter()?.items as? List<GjjImportTally> ?: return@observeForever val list = pageModel.rv?.commonAdapter()?.items as? List<GjjImportTally> ?: return@observeForever
list.forEach { list.forEach {