feat: 国际进港查询筛选按钮有效时显示红点提示

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-04-01 18:39:28 +08:00
parent 3e5f185721
commit 624331ca68
3 changed files with 39 additions and 5 deletions

View File

@@ -2,6 +2,7 @@ package com.lukouguoji.gjj.viewModel
import android.app.Activity
import android.content.Intent
import androidx.lifecycle.MediatorLiveData
import androidx.lifecycle.MutableLiveData
import com.lukouguoji.gjj.R
import com.lukouguoji.gjj.activity.IntImpQueryEditActivity
@@ -71,6 +72,20 @@ class IntImpQueryViewModel : BasePageViewModel(), IOnItemClickListener {
val businessType = MutableLiveData("")
val goodsCn = MutableLiveData("")
// 是否有筛选条件(任意一个非空则为 true)
val hasFilter: MediatorLiveData<Boolean> = MediatorLiveData<Boolean>().apply {
val update = { _: Any? ->
value = listOf(spCode, flightNo, origin, awbType, businessType, goodsCn)
.any { !it.value.isNullOrEmpty() }
}
addSource(spCode, update)
addSource(flightNo, update)
addSource(origin, update)
addSource(awbType, update)
addSource(businessType, update)
addSource(goodsCn, update)
}
///////////////////////////////////////////////////////////////////////////
// 方法区
///////////////////////////////////////////////////////////////////////////