Compare commits
2 Commits
27d6e55cbe
...
1fa0f6dde4
| Author | SHA1 | Date | |
|---|---|---|---|
| 1fa0f6dde4 | |||
| faf343301f |
@@ -44,7 +44,8 @@ class LogDetailActivity : BaseBindingActivity<ActivityLogDetailBinding, LogDetai
|
||||
viewModel.latestStepCode.observe(this) { rebuildSteps() }
|
||||
|
||||
viewModel.statusLogList.observe(this) { list ->
|
||||
timelineAdapter.setData(list)
|
||||
val stepMap = viewModel.allSteps.value?.associate { it.code to it.name } ?: emptyMap()
|
||||
timelineAdapter.setData(list, stepMap)
|
||||
}
|
||||
|
||||
viewModel.initOnCreated(intent)
|
||||
|
||||
@@ -11,9 +11,11 @@ import com.lukouguoji.module_base.bean.StatusLogBean
|
||||
class LogDetailTimelineAdapter : RecyclerView.Adapter<LogDetailTimelineAdapter.TimelineViewHolder>() {
|
||||
|
||||
private var items: List<StatusLogBean> = emptyList()
|
||||
private var statusNameMap: Map<String, String> = emptyMap()
|
||||
|
||||
fun setData(list: List<StatusLogBean>) {
|
||||
fun setData(list: List<StatusLogBean>, stepMap: Map<String, String> = emptyMap()) {
|
||||
items = list
|
||||
statusNameMap = stepMap
|
||||
notifyDataSetChanged()
|
||||
}
|
||||
|
||||
@@ -28,8 +30,9 @@ class LogDetailTimelineAdapter : RecyclerView.Adapter<LogDetailTimelineAdapter.T
|
||||
val isFirst = position == 0
|
||||
val isLast = position == items.size - 1
|
||||
|
||||
holder.tvContent.text = item.content
|
||||
holder.tvTime.text = item.opDate
|
||||
val statusName = statusNameMap[item.status] ?: item.status
|
||||
holder.tvContent.text = if (statusName.isNotEmpty()) "$statusName ${item.opDate}" else item.opDate
|
||||
holder.tvTime.text = item.content
|
||||
|
||||
// 最后一项(当前步骤)用绿色圆点
|
||||
holder.dotView.setBackgroundResource(
|
||||
|
||||
@@ -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