feat: 出港计重 代理 filter
This commit is contained in:
@@ -30,6 +30,9 @@ class GjcWeighingListActivity :
|
|||||||
|
|
||||||
binding.viewModel = viewModel
|
binding.viewModel = viewModel
|
||||||
|
|
||||||
|
// 初始化代理人列表(从API获取)
|
||||||
|
viewModel.initAgentList()
|
||||||
|
|
||||||
// 绑定分页逻辑
|
// 绑定分页逻辑
|
||||||
viewModel.pageModel
|
viewModel.pageModel
|
||||||
.bindSmartRefreshLayout(binding.srl, binding.rv, viewModel, getLifecycleOwner())
|
.bindSmartRefreshLayout(binding.srl, binding.rv, viewModel, getLifecycleOwner())
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ import com.lukouguoji.module_base.ktx.launchLoadingCollect
|
|||||||
import com.lukouguoji.module_base.ktx.showToast
|
import com.lukouguoji.module_base.ktx.showToast
|
||||||
import com.lukouguoji.module_base.ktx.toRequestBody
|
import com.lukouguoji.module_base.ktx.toRequestBody
|
||||||
import com.lukouguoji.module_base.model.ScanModel
|
import com.lukouguoji.module_base.model.ScanModel
|
||||||
|
import dev.utils.app.info.KeyValue
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 国际出港计重 ViewModel
|
* 国际出港计重 ViewModel
|
||||||
@@ -28,6 +29,9 @@ class GjcWeighingViewModel : BasePageViewModel() {
|
|||||||
val spCode = MutableLiveData("") // 特码
|
val spCode = MutableLiveData("") // 特码
|
||||||
val waybillNo = MutableLiveData("") // 运单号
|
val waybillNo = MutableLiveData("") // 运单号
|
||||||
|
|
||||||
|
// 下拉列表数据源
|
||||||
|
val agentList = MutableLiveData(listOf(KeyValue("全部", "")))
|
||||||
|
|
||||||
// 适配器配置
|
// 适配器配置
|
||||||
val itemViewHolder = GjcWeighingViewHolder::class.java
|
val itemViewHolder = GjcWeighingViewHolder::class.java
|
||||||
val itemLayoutId = R.layout.item_gjc_weighing
|
val itemLayoutId = R.layout.item_gjc_weighing
|
||||||
@@ -41,6 +45,25 @@ class GjcWeighingViewModel : BasePageViewModel() {
|
|||||||
// 方法区
|
// 方法区
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 初始化代理下拉列表(从API获取)
|
||||||
|
*/
|
||||||
|
fun initAgentList() {
|
||||||
|
launchCollect({
|
||||||
|
// 调用API获取代理人列表
|
||||||
|
NetApply.api.getIntExpAgentList()
|
||||||
|
}) {
|
||||||
|
onSuccess = { result ->
|
||||||
|
val list = mutableListOf(KeyValue("全部", ""))
|
||||||
|
// 将DictBean转换为KeyValue
|
||||||
|
result.data?.forEach {
|
||||||
|
list.add(KeyValue(it.name ?: "", it.code ?: ""))
|
||||||
|
}
|
||||||
|
agentList.value = list
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 扫码输入航班号
|
* 扫码输入航班号
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -53,6 +53,7 @@
|
|||||||
<!-- 择代理 -->
|
<!-- 择代理 -->
|
||||||
<com.lukouguoji.module_base.ui.weight.search.layout.PadSearchLayout
|
<com.lukouguoji.module_base.ui.weight.search.layout.PadSearchLayout
|
||||||
hint='@{"请选择代理"}'
|
hint='@{"请选择代理"}'
|
||||||
|
list="@{viewModel.agentList}"
|
||||||
type="@{SearchLayoutType.SPINNER}"
|
type="@{SearchLayoutType.SPINNER}"
|
||||||
value="@={viewModel.agentCode}"
|
value="@={viewModel.agentCode}"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
|
|||||||
Reference in New Issue
Block a user