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:
@@ -1,7 +1,6 @@
|
||||
package com.lukouguoji.gjj.holder
|
||||
|
||||
import android.view.View
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.lukouguoji.gjj.databinding.ItemIntImpTallySubBinding
|
||||
import com.lukouguoji.module_base.base.BaseViewHolder
|
||||
import com.lukouguoji.module_base.bean.GjjImportTally
|
||||
@@ -18,26 +17,10 @@ class IntImpTallySubViewHolder(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()
|
||||
|
||||
// 反向联动主列表项(勾选时联动主项也勾选)
|
||||
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)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,18 +25,10 @@ class IntImpTallyViewHolder(view: View) :
|
||||
binding.position = position
|
||||
binding.executePendingBindings()
|
||||
|
||||
// 选中图标点击 - 切换选择状态(联动子列表)
|
||||
// 选中图标点击 - 切换选择状态(独立选择,不联动分单)
|
||||
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()
|
||||
}
|
||||
|
||||
// 整个内容区域点击 - 跳转到详情页
|
||||
|
||||
@@ -37,7 +37,6 @@ class IntImpAccidentVisaViewModel : BasePageViewModel() {
|
||||
val wbNo = MutableLiveData("") // 运单号
|
||||
|
||||
// ========== 航班查询 ==========
|
||||
private var fid: String = ""
|
||||
private var lastQueriedFlight = ""
|
||||
|
||||
// ========== 统计信息 ==========
|
||||
@@ -91,7 +90,6 @@ class IntImpAccidentVisaViewModel : BasePageViewModel() {
|
||||
onSuccess = {
|
||||
if (it.verifySuccess() && it.data != null) {
|
||||
val flight = it.data!!
|
||||
fid = flight.fid.noNull()
|
||||
fdest.value = flight.fdest.noNull()
|
||||
|
||||
val list = mutableListOf(
|
||||
@@ -103,7 +101,6 @@ class IntImpAccidentVisaViewModel : BasePageViewModel() {
|
||||
fdepList.value = list
|
||||
fdep.value = flight.fdep.noNull()
|
||||
} else {
|
||||
fid = ""
|
||||
fdest.value = ""
|
||||
fdepList.value = emptyList()
|
||||
fdep.value = ""
|
||||
@@ -112,7 +109,6 @@ class IntImpAccidentVisaViewModel : BasePageViewModel() {
|
||||
}
|
||||
|
||||
onFailed = { _, _ ->
|
||||
fid = ""
|
||||
fdest.value = ""
|
||||
fdepList.value = emptyList()
|
||||
fdep.value = ""
|
||||
@@ -177,17 +173,13 @@ class IntImpAccidentVisaViewModel : BasePageViewModel() {
|
||||
}
|
||||
|
||||
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 },
|
||||
"fdest" to fdest.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(
|
||||
"pageNum" to pageModel.page,
|
||||
|
||||
@@ -43,7 +43,7 @@ class IntImpTallyViewModel : BasePageViewModel() {
|
||||
val isAllChecked = MutableLiveData(false)
|
||||
|
||||
init {
|
||||
// 监听全选状态,自动更新所有列表项(联动子列表)
|
||||
// 监听全选状态,自动更新所有列表项(主单和分单独立全选)
|
||||
isAllChecked.observeForever { checked ->
|
||||
val list = pageModel.rv?.commonAdapter()?.items as? List<GjjImportTally> ?: return@observeForever
|
||||
list.forEach {
|
||||
|
||||
Reference in New Issue
Block a user