From a3b87462647dc493dfbe46c70abf7520b80fe4fd Mon Sep 17 00:00:00 2001 From: YANGJIANKUAN Date: Mon, 8 Dec 2025 17:17:40 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=87=BA=E6=B8=AF=E8=AE=A1=E9=87=8D=20?= =?UTF-8?q?=E5=B7=B2=E8=AE=A1=E9=87=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../activity/GjcWeighingRecordListActivity.kt | 6 ++ .../viewModel/GjcWeighingRecordViewModel.kt | 36 ++++++++ .../activity_gjc_weighing_record_list.xml | 21 ++--- .../res/layout/item_gjc_weighing_record.xml | 89 +++++++------------ 4 files changed, 84 insertions(+), 68 deletions(-) diff --git a/module_gjc/src/main/java/com/lukouguoji/gjc/activity/GjcWeighingRecordListActivity.kt b/module_gjc/src/main/java/com/lukouguoji/gjc/activity/GjcWeighingRecordListActivity.kt index 7231c63..b40b729 100644 --- a/module_gjc/src/main/java/com/lukouguoji/gjc/activity/GjcWeighingRecordListActivity.kt +++ b/module_gjc/src/main/java/com/lukouguoji/gjc/activity/GjcWeighingRecordListActivity.kt @@ -30,6 +30,12 @@ class GjcWeighingRecordListActivity : binding.viewModel = viewModel + // 初始化代理人列表 + viewModel.initAgentList() + + // 初始化特码列表 + viewModel.initSpecialCodeList() + // 绑定分页逻辑 viewModel.pageModel .bindSmartRefreshLayout(binding.srl, binding.rv, viewModel, getLifecycleOwner()) diff --git a/module_gjc/src/main/java/com/lukouguoji/gjc/viewModel/GjcWeighingRecordViewModel.kt b/module_gjc/src/main/java/com/lukouguoji/gjc/viewModel/GjcWeighingRecordViewModel.kt index ebe7f3f..d53ec30 100644 --- a/module_gjc/src/main/java/com/lukouguoji/gjc/viewModel/GjcWeighingRecordViewModel.kt +++ b/module_gjc/src/main/java/com/lukouguoji/gjc/viewModel/GjcWeighingRecordViewModel.kt @@ -12,6 +12,8 @@ import com.lukouguoji.module_base.ktx.launchCollect import com.lukouguoji.module_base.ktx.launchLoadingCollect import com.lukouguoji.module_base.ktx.toRequestBody import com.lukouguoji.module_base.model.ScanModel +import com.lukouguoji.module_base.util.DictUtils +import dev.utils.app.info.KeyValue /** * 国际出港计重记录 ViewModel @@ -25,6 +27,10 @@ class GjcWeighingRecordViewModel : BasePageViewModel() { val spCode = MutableLiveData("") // 特码 val waybillNo = MutableLiveData("") // 运单号 + // 下拉列表数据源 + val agentList = MutableLiveData(listOf(KeyValue("全部", ""))) + val spCodeList = MutableLiveData>(emptyList()) + // 适配器配置 val itemViewHolder = GjcWeighingRecordViewHolder::class.java val itemLayoutId = R.layout.item_gjc_weighing_record @@ -39,6 +45,36 @@ class GjcWeighingRecordViewModel : BasePageViewModel() { // 方法区 /////////////////////////////////////////////////////////////////////////// + /** + * 初始化代理人列表 + */ + fun initAgentList() { + launchCollect({ + NetApply.api.getIntExpAgentList() + }) { + onSuccess = { result -> + val list = mutableListOf(KeyValue("全部", "")) + result.data?.forEach { + list.add(KeyValue(it.name ?: "", it.code ?: "")) + } + agentList.value = list + } + } + } + + /** + * 初始化特码列表 + */ + fun initSpecialCodeList() { + DictUtils.getSpecialCodeList( + flag = 1, // 国际 + ieFlag = "", // 空字符串 + parentcode = "" // 无父级 + ) { + spCodeList.value = it + } + } + /** * 扫码输入航班号 */ diff --git a/module_gjc/src/main/res/layout/activity_gjc_weighing_record_list.xml b/module_gjc/src/main/res/layout/activity_gjc_weighing_record_list.xml index 6c32851..c1c2544 100644 --- a/module_gjc/src/main/res/layout/activity_gjc_weighing_record_list.xml +++ b/module_gjc/src/main/res/layout/activity_gjc_weighing_record_list.xml @@ -56,6 +56,7 @@ android:layout_height="wrap_content" android:layout_weight="1" hint='@{"请选择代理"}' + list="@{viewModel.agentList}" type="@{SearchLayoutType.SPINNER}" value="@={viewModel.agentCode}" /> @@ -65,6 +66,7 @@ android:layout_height="wrap_content" android:layout_weight="1" hint='@{"请选择特码"}' + list="@{viewModel.spCodeList}" type="@{SearchLayoutType.SPINNER}" value="@={viewModel.spCode}" /> @@ -84,12 +86,15 @@ android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" - android:gravity="center"> + android:gravity="center_vertical|start" + android:orientation="horizontal" + android:paddingHorizontal="24dp"> @@ -159,16 +164,6 @@ android:textStyle="bold" tools:text="总重量:100" /> - - diff --git a/module_gjc/src/main/res/layout/item_gjc_weighing_record.xml b/module_gjc/src/main/res/layout/item_gjc_weighing_record.xml index 488f068..14b8077 100644 --- a/module_gjc/src/main/res/layout/item_gjc_weighing_record.xml +++ b/module_gjc/src/main/res/layout/item_gjc_weighing_record.xml @@ -30,8 +30,8 @@ @@ -47,59 +47,59 @@ android:gravity="center_vertical"> - + + android:text="预配件数:" /> + android:text='@{String.valueOf(bean.pc)}' + tools:text="10" /> - + + android:text="预配重量:" /> + android:text='@{String.valueOf((int)bean.weight)}' + tools:text="100" /> @@ -111,9 +111,9 @@ android:gravity="center_vertical"> - + + android:text="代理人:" /> + android:text='@{bean.agentName}' + tools:text="顺丰" /> - + - - - - - - - - - + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="特码:" /> + android:text='@{bean.spCode}' + tools:text="NOR" /> @@ -224,9 +203,9 @@ android:gravity="center_vertical"> + android:layout_marginLeft="10dp" + android:src="@drawable/img_pda_right" />