From 9149d1ad350cdc2567652712dad6ea994aedce16 Mon Sep 17 00:00:00 2001 From: YANGJIANKUAN Date: Mon, 8 Dec 2025 15:02:06 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=9B=BD=E9=99=85=E5=87=BA=E6=B8=AF=20?= =?UTF-8?q?=E5=BC=80=E5=A7=8B=E8=AE=A1=E9=87=8D=20=E9=80=9A=E9=81=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../module_base/bean/DictLocationBean.kt | 17 +++++++++++++++++ .../com/lukouguoji/module_base/http/net/Api.kt | 6 ++++++ .../lukouguoji/module_base/util/DictUtils.kt | 2 +- .../res/layout/activity_gjc_weighing_start.xml | 1 + 4 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 module_base/src/main/java/com/lukouguoji/module_base/bean/DictLocationBean.kt diff --git a/module_base/src/main/java/com/lukouguoji/module_base/bean/DictLocationBean.kt b/module_base/src/main/java/com/lukouguoji/module_base/bean/DictLocationBean.kt new file mode 100644 index 0000000..45ac5d6 --- /dev/null +++ b/module_base/src/main/java/com/lukouguoji/module_base/bean/DictLocationBean.kt @@ -0,0 +1,17 @@ +package com.lukouguoji.module_base.bean + +import dev.utils.app.info.KeyValue + +/** + * 字典-Location接口返回数据Bean + */ +data class DictLocationBean( + var code: String = "", // 编码值 (例如: "18") + var name: String = "" // 显示名称 (例如: "国际出港通道01") +) { + /** + * 转换为KeyValue + * KeyValue(显示名称, 编码值) + */ + fun toKeyValue() = KeyValue(name, code) +} diff --git a/module_base/src/main/java/com/lukouguoji/module_base/http/net/Api.kt b/module_base/src/main/java/com/lukouguoji/module_base/http/net/Api.kt index 55a6755..b9ab765 100644 --- a/module_base/src/main/java/com/lukouguoji/module_base/http/net/Api.kt +++ b/module_base/src/main/java/com/lukouguoji/module_base/http/net/Api.kt @@ -13,6 +13,7 @@ import com.lukouguoji.module_base.bean.CarOrUldBean import com.lukouguoji.module_base.bean.DiBangChannelBean import com.lukouguoji.module_base.bean.DictIdValueBean import com.lukouguoji.module_base.bean.DictListBean +import com.lukouguoji.module_base.bean.DictLocationBean import com.lukouguoji.module_base.bean.DocumentHandoverBean import com.lukouguoji.module_base.bean.FlatcarBean import com.lukouguoji.module_base.bean.FlightBean @@ -150,6 +151,11 @@ interface Api { @GET("typeCode/searchDateType") suspend fun getDictList(@Query("code") code: String): BaseResultBean> + /** + * 获取字典列表 - location接口 + */ + @GET("typeCode/locationByCode") + suspend fun getDictListByLocation(@Query("code") code: String): BaseResultBean> /** * 获取字典列表----根据用户角色选择转运类型 diff --git a/module_base/src/main/java/com/lukouguoji/module_base/util/DictUtils.kt b/module_base/src/main/java/com/lukouguoji/module_base/util/DictUtils.kt index ffb54f4..feac4e3 100644 --- a/module_base/src/main/java/com/lukouguoji/module_base/util/DictUtils.kt +++ b/module_base/src/main/java/com/lukouguoji/module_base/util/DictUtils.kt @@ -409,7 +409,7 @@ object DictUtils { ) { launchCollect({ NetApply.api - .getDictList("GJCPASSAGEWAY") + .getDictListByLocation("GJCPASSAGEWAY") }) { onSuccess = { callBack((it.data ?: emptyList()).map { b -> b.toKeyValue() }) diff --git a/module_gjc/src/main/res/layout/activity_gjc_weighing_start.xml b/module_gjc/src/main/res/layout/activity_gjc_weighing_start.xml index 43a37bf..815cbc7 100644 --- a/module_gjc/src/main/res/layout/activity_gjc_weighing_start.xml +++ b/module_gjc/src/main/res/layout/activity_gjc_weighing_start.xml @@ -74,6 +74,7 @@ titleLength="@{5}" type="@{DataLayoutType.SPINNER}" value='@={viewModel.channel}' + required="@{true}" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_marginStart="15dp"