feat: ULD新增编辑表单增加来源、入库时间、所在港字段
- 编辑表单新增来源(空运/陆运)、入库时间、所在港(默认HFE)三个字段 - 列表项同步显示来源、所在港、位置、入库时间,去掉备注展示并收窄首列 - PadDataLayoutNew 新增 DATETIME 类型,支持年月日时分秒选择 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -30,6 +30,14 @@ class UldEditViewModel : BaseViewModel() {
|
||||
)
|
||||
)
|
||||
|
||||
// 来源下拉列表
|
||||
val sourceList = MutableLiveData<List<KeyValue>>(
|
||||
listOf(
|
||||
KeyValue("空运", "空运"),
|
||||
KeyValue("陆运", "陆运"),
|
||||
)
|
||||
)
|
||||
|
||||
// 所属航司下拉列表(数据源:POST /typeCode/intCarrier)
|
||||
val carrierList = MutableLiveData<List<KeyValue>>(emptyList())
|
||||
|
||||
@@ -40,7 +48,8 @@ class UldEditViewModel : BaseViewModel() {
|
||||
else if (modify) DetailsPageType.Modify else DetailsPageType.Details
|
||||
|
||||
if (id.isEmpty()) {
|
||||
// 新增:直接加载航司列表
|
||||
// 新增:所在港默认 HFE,直接加载航司列表
|
||||
uldBean.value = ULDBean(nowPort = "HFE")
|
||||
loadCarrierList(null)
|
||||
} else {
|
||||
getData()
|
||||
@@ -79,7 +88,7 @@ class UldEditViewModel : BaseViewModel() {
|
||||
}) {
|
||||
onSuccess = {
|
||||
showToast(it.msg.noNull(if (isAdd) "新增成功" else "修改成功"))
|
||||
if (isAdd) uldBean.value = ULDBean() else getData()
|
||||
if (isAdd) uldBean.value = ULDBean(nowPort = "HFE") else getData()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -121,6 +121,49 @@
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<!-- Row 3: 来源 / 入库时间 / 所在港 -->
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<com.lukouguoji.module_base.ui.weight.data.layout.PadDataLayoutNew
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
enable="@{viewModel.pageType != DetailsPageType.Details}"
|
||||
hint='@{"请选择来源"}'
|
||||
list="@{viewModel.sourceList}"
|
||||
title='@{"来源"}'
|
||||
titleLength="@{7}"
|
||||
type="@{DataLayoutType.SPINNER}"
|
||||
value='@={viewModel.uldBean.source}' />
|
||||
|
||||
<com.lukouguoji.module_base.ui.weight.data.layout.PadDataLayoutNew
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
enable="@{viewModel.pageType != DetailsPageType.Details}"
|
||||
hint='@{"请选择入库时间"}'
|
||||
title='@{"入库时间"}'
|
||||
titleLength="@{5}"
|
||||
type="@{DataLayoutType.DATETIME}"
|
||||
value='@={viewModel.uldBean.inStoreTime}' />
|
||||
|
||||
<com.lukouguoji.module_base.ui.weight.data.layout.PadDataLayoutNew
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
enable="@{viewModel.pageType != DetailsPageType.Details}"
|
||||
hint='@{"请输入所在港"}'
|
||||
title='@{"所在港"}'
|
||||
titleLength="@{5}"
|
||||
type="@{DataLayoutType.INPUT}"
|
||||
value='@={viewModel.uldBean.nowPort}' />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<!-- 备注(全行,多行输入) -->
|
||||
<com.lukouguoji.module_base.ui.weight.data.layout.PadDataLayoutNew
|
||||
android:layout_width="match_parent"
|
||||
|
||||
@@ -55,7 +55,7 @@
|
||||
<androidx.appcompat.widget.LinearLayoutCompat
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1.5"
|
||||
android:layout_weight="1.0"
|
||||
android:gravity="center_vertical">
|
||||
|
||||
<TextView
|
||||
@@ -109,7 +109,7 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:text="自重:"
|
||||
android:textSize="15sp"
|
||||
completeSpace="@{3}" />
|
||||
completeSpace="@{4}" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
@@ -165,7 +165,7 @@
|
||||
|
||||
</androidx.appcompat.widget.LinearLayoutCompat>
|
||||
|
||||
<!-- 第二行:最大载重 | 备注 -->
|
||||
<!-- 第二行:最大载重 | 来源 | 所在港 | 位置 | 入库时间 -->
|
||||
<androidx.appcompat.widget.LinearLayoutCompat
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
@@ -175,7 +175,7 @@
|
||||
<androidx.appcompat.widget.LinearLayoutCompat
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1.5"
|
||||
android:layout_weight="1.0"
|
||||
android:gravity="center_vertical">
|
||||
|
||||
<TextView
|
||||
@@ -193,24 +193,90 @@
|
||||
|
||||
</androidx.appcompat.widget.LinearLayoutCompat>
|
||||
|
||||
<!-- 备注 -->
|
||||
<!-- 来源 -->
|
||||
<androidx.appcompat.widget.LinearLayoutCompat
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="3.6"
|
||||
android:layout_weight="0.8"
|
||||
android:gravity="center_vertical">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="备注:"
|
||||
android:text="来源:"
|
||||
android:textSize="15sp"
|
||||
completeSpace="@{3}" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@{bean.remark}"
|
||||
android:text="@{bean.source}"
|
||||
android:textSize="15sp" />
|
||||
|
||||
</androidx.appcompat.widget.LinearLayoutCompat>
|
||||
|
||||
<!-- 所在港 -->
|
||||
<androidx.appcompat.widget.LinearLayoutCompat
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="0.8"
|
||||
android:gravity="center_vertical">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="所在港:"
|
||||
android:textSize="15sp"
|
||||
completeSpace="@{4}" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@{bean.nowPort}"
|
||||
android:textSize="15sp" />
|
||||
|
||||
</androidx.appcompat.widget.LinearLayoutCompat>
|
||||
|
||||
<!-- 位置 -->
|
||||
<androidx.appcompat.widget.LinearLayoutCompat
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="0.8"
|
||||
android:gravity="center_vertical">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="位置:"
|
||||
android:textSize="15sp"
|
||||
completeSpace="@{5}" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@{bean.nowPosition}"
|
||||
android:textSize="15sp" />
|
||||
|
||||
</androidx.appcompat.widget.LinearLayoutCompat>
|
||||
|
||||
<!-- 入库时间 -->
|
||||
<androidx.appcompat.widget.LinearLayoutCompat
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1.2"
|
||||
android:gravity="center_vertical">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="入库时间:"
|
||||
android:textSize="15sp"
|
||||
completeSpace="@{7}" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@{bean.inStoreTime}"
|
||||
android:textSize="15sp" />
|
||||
|
||||
</androidx.appcompat.widget.LinearLayoutCompat>
|
||||
|
||||
@@ -19,6 +19,14 @@ data class ULDBean(
|
||||
var status: String = "",
|
||||
// 备注
|
||||
var remark: String = "",
|
||||
// 来源(空运、陆运)
|
||||
var source: String = "",
|
||||
// 入库时间 yyyy-MM-dd HH:mm:ss
|
||||
var inStoreTime: String = "",
|
||||
// 所在港
|
||||
var nowPort: String = "",
|
||||
// 位置信息
|
||||
var nowPosition: String = "",
|
||||
){
|
||||
val checked = ObservableBoolean(false)
|
||||
|
||||
|
||||
@@ -211,7 +211,7 @@ class PadDataLayout : FrameLayout {
|
||||
setOnClickListener(null)
|
||||
}
|
||||
|
||||
DataLayoutType.DATE -> {
|
||||
DataLayoutType.DATE, DataLayoutType.DATETIME -> {
|
||||
tv.visibility = VISIBLE
|
||||
et.visibility = GONE
|
||||
spinner.visibility = GONE
|
||||
@@ -258,4 +258,5 @@ enum class DataLayoutType {
|
||||
INPUT, // 文本
|
||||
SPINNER, // 下拉选择
|
||||
DATE, // 日期
|
||||
DATETIME, // 日期时间(yyyy-MM-dd HH:mm:ss)
|
||||
}
|
||||
|
||||
@@ -25,6 +25,7 @@ import com.lukouguoji.module_base.adapter.visible
|
||||
import com.lukouguoji.module_base.interfaces.IOnFocusChangeListener
|
||||
import com.lukouguoji.module_base.interfaces.IOnSpinnerSelected
|
||||
import com.lukouguoji.module_base.ktx.formatDate
|
||||
import com.lukouguoji.module_base.ktx.formatDateTime
|
||||
import com.lukouguoji.module_base.ktx.getActivity
|
||||
import com.lukouguoji.module_base.ktx.loge
|
||||
import com.lukouguoji.module_base.util.Common
|
||||
@@ -182,6 +183,18 @@ class PadDataLayoutNew : FrameLayout {
|
||||
}
|
||||
}
|
||||
|
||||
// 选择日期时间(yyyy-MM-dd HH:mm:ss)
|
||||
private val dateTimeClick: (v: View) -> Unit = {
|
||||
if (enable) {
|
||||
Common.onYearMonthDayTime(context.getActivity(), value) { year, month, day, hour, minute, second ->
|
||||
val calendar = Calendar.getInstance()
|
||||
calendar.set(year, month - 1, day, hour, minute, second)
|
||||
value = calendar.time.formatDateTime()
|
||||
refreshCallBack?.invoke()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
init {
|
||||
initView()
|
||||
}
|
||||
@@ -252,7 +265,7 @@ class PadDataLayoutNew : FrameLayout {
|
||||
setOnClickListener(null)
|
||||
}
|
||||
|
||||
DataLayoutType.DATE -> {
|
||||
DataLayoutType.DATE, DataLayoutType.DATETIME -> {
|
||||
tv.visibility = VISIBLE
|
||||
et.visibility = GONE
|
||||
spinner.visibility = GONE
|
||||
@@ -263,7 +276,7 @@ class PadDataLayoutNew : FrameLayout {
|
||||
iv.layoutParams.width = dp20
|
||||
iv.layoutParams.height = dp20
|
||||
|
||||
setOnClickListener(dateClick)
|
||||
setOnClickListener(if (type == DataLayoutType.DATETIME) dateTimeClick else dateClick)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user