feat: fix issues
This commit is contained in:
@@ -102,6 +102,24 @@ object DictUtils {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取国际进港代理列表
|
||||
*/
|
||||
fun getIntImpAgentList(
|
||||
addAll: Boolean = true,
|
||||
checkedValue: String? = null,
|
||||
callBack: (List<KeyValue>) -> Unit
|
||||
) {
|
||||
launchCollect({
|
||||
NetApply.api
|
||||
.getIntImpAgentList()
|
||||
}) {
|
||||
onSuccess = {
|
||||
handleCallBack(it, checkedValue, addAll, callBack)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取仓管列表
|
||||
*/
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.lukouguoji.gjj.viewModel
|
||||
|
||||
import android.content.Intent
|
||||
import android.view.View
|
||||
import androidx.lifecycle.MediatorLiveData
|
||||
import androidx.lifecycle.MutableLiveData
|
||||
import androidx.lifecycle.viewModelScope
|
||||
import com.lukouguoji.module_base.base.BaseViewModel
|
||||
@@ -38,9 +39,6 @@ class GjjManifestAddViewModel : BaseViewModel() {
|
||||
// 航班号
|
||||
val flightNo = MutableLiveData("")
|
||||
|
||||
// 航程
|
||||
val range = MutableLiveData("")
|
||||
|
||||
// 运单号
|
||||
val waybillNo = MutableLiveData("")
|
||||
|
||||
@@ -80,12 +78,10 @@ class GjjManifestAddViewModel : BaseViewModel() {
|
||||
fid = flight.fid.noNull()
|
||||
departure.value = flight.fdep.noNull()
|
||||
destination.value = flight.fdest.noNull()
|
||||
range.value = flight.range.noNull()
|
||||
} else {
|
||||
fid = ""
|
||||
departure.value = ""
|
||||
destination.value = ""
|
||||
range.value = ""
|
||||
showToast(it.msg.noNull("获取航班信息失败"))
|
||||
}
|
||||
}
|
||||
@@ -93,7 +89,6 @@ class GjjManifestAddViewModel : BaseViewModel() {
|
||||
fid = ""
|
||||
departure.value = ""
|
||||
destination.value = ""
|
||||
range.value = ""
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -119,6 +114,17 @@ class GjjManifestAddViewModel : BaseViewModel() {
|
||||
// 目的港
|
||||
val destination = MutableLiveData("")
|
||||
|
||||
// 航程(自动拼接:始发站-目的站)
|
||||
val range = MediatorLiveData<String>().apply {
|
||||
val update = {
|
||||
val dep = departure.value ?: ""
|
||||
val dest = destination.value ?: ""
|
||||
value = if (dep.isNotEmpty() || dest.isNotEmpty()) "$dep-$dest" else ""
|
||||
}
|
||||
addSource(departure) { update() }
|
||||
addSource(destination) { update() }
|
||||
}
|
||||
|
||||
// 品名(中)
|
||||
val goodsNameCn = MutableLiveData("")
|
||||
|
||||
@@ -154,10 +160,10 @@ class GjjManifestAddViewModel : BaseViewModel() {
|
||||
val waybillType = MutableLiveData("")
|
||||
|
||||
init {
|
||||
DictUtils.getAgentList(addAll = false) {
|
||||
DictUtils.getIntImpAgentList(addAll = false) {
|
||||
agentList.postValue(listOf(KeyValue("", "")) + it)
|
||||
}
|
||||
DictUtils.getSpecialCodeList(addAll = false, flag = 1, ieFlag = "I") {
|
||||
DictUtils.getSpecialCodeList(addAll = false, flag = 1, ieFlag = "") {
|
||||
val list = arrayListOf<KeyValue>()
|
||||
it.find { b -> b.key.contains("普通货物") }?.let { b ->
|
||||
list.add(b)
|
||||
@@ -168,7 +174,7 @@ class GjjManifestAddViewModel : BaseViewModel() {
|
||||
DictUtils.getBusinessTypeList(addAll = false) {
|
||||
businessTypeList.postValue(it)
|
||||
}
|
||||
DictUtils.getGjjPackageTypeList(addAll = false) {
|
||||
DictUtils.getShouYunPackageTypeList {
|
||||
packageTypeList.postValue(listOf(KeyValue("", "")) + it)
|
||||
}
|
||||
DictUtils.getGjjGoodsTypeList(addAll = false) {
|
||||
|
||||
@@ -79,13 +79,13 @@
|
||||
android:layout_weight="1" />
|
||||
|
||||
<com.lukouguoji.module_base.ui.weight.data.layout.PadDataLayoutNew
|
||||
enable="@{viewModel.pageType == DetailsPageType.Add}"
|
||||
hint='@{"请输入航程"}'
|
||||
enable="@{false}"
|
||||
hint='@{"自动填充"}'
|
||||
required="@{false}"
|
||||
title='@{"航 程"}'
|
||||
titleLength="@{5}"
|
||||
type="@{DataLayoutType.INPUT}"
|
||||
value='@={viewModel.range}'
|
||||
value='@{viewModel.range}'
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="15dp"
|
||||
|
||||
@@ -39,11 +39,11 @@
|
||||
android:orientation="vertical"
|
||||
android:padding="15dp">
|
||||
|
||||
<!-- 段落标题:收货人信息 -->
|
||||
<!-- 段落标题:基础信息 -->
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="收货人信息"
|
||||
android:text="基础信息"
|
||||
android:textColor="@color/text_normal"
|
||||
android:textSize="16sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
@@ -18,14 +18,13 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@drawable/bg_white_radius_bottom_8"
|
||||
android:orientation="vertical"
|
||||
android:paddingEnd="8dp">
|
||||
android:orientation="vertical">
|
||||
|
||||
<!-- 表头 -->
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="40dp"
|
||||
android:background="@color/color_f2"
|
||||
android:background="@color/color_f5"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal"
|
||||
android:paddingHorizontal="10dp">
|
||||
|
||||
@@ -18,14 +18,13 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@drawable/bg_white_radius_bottom_8"
|
||||
android:orientation="vertical"
|
||||
android:paddingEnd="8dp">
|
||||
android:orientation="vertical">
|
||||
|
||||
<!-- 表头 -->
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="40dp"
|
||||
android:background="@color/color_f2"
|
||||
android:background="@color/color_f5"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal"
|
||||
android:paddingHorizontal="10dp">
|
||||
|
||||
Reference in New Issue
Block a user