feat: 航班新增/编辑表单精简字段并补充必填校验
去掉进出港、货邮状态、运单前缀三个输入项;地区类型、服务类型、 计划起飞、预计起飞、计划降落、预计降落改为必填并显示星号。 编辑模式下被移除字段仍原值回传,避免更新时被清空。 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
@@ -41,7 +41,6 @@ class HbFlightEditViewModel : BaseViewModel() {
|
|||||||
val fdest = MutableLiveData("")
|
val fdest = MutableLiveData("")
|
||||||
val countryType = MutableLiveData("")
|
val countryType = MutableLiveData("")
|
||||||
val serviceType = MutableLiveData("")
|
val serviceType = MutableLiveData("")
|
||||||
val status = MutableLiveData("")
|
|
||||||
val scheduledTackOff = MutableLiveData("")
|
val scheduledTackOff = MutableLiveData("")
|
||||||
val estimatedTakeOff = MutableLiveData("")
|
val estimatedTakeOff = MutableLiveData("")
|
||||||
val actualTakeOff = MutableLiveData("")
|
val actualTakeOff = MutableLiveData("")
|
||||||
@@ -50,20 +49,21 @@ class HbFlightEditViewModel : BaseViewModel() {
|
|||||||
val actualArrival = MutableLiveData("")
|
val actualArrival = MutableLiveData("")
|
||||||
val standId = MutableLiveData("")
|
val standId = MutableLiveData("")
|
||||||
val registration = MutableLiveData("")
|
val registration = MutableLiveData("")
|
||||||
val prefix = MutableLiveData("")
|
|
||||||
val flightStatus = MutableLiveData("")
|
val flightStatus = MutableLiveData("")
|
||||||
val cmFlag = MutableLiveData("")
|
|
||||||
val delayFreeText = MutableLiveData("")
|
val delayFreeText = MutableLiveData("")
|
||||||
|
|
||||||
|
// 表单已不展示的字段:编辑模式保留服务端原值原样回传,避免更新时被清空
|
||||||
|
private var status = ""
|
||||||
|
private var prefix = ""
|
||||||
|
private var cmFlag = ""
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
// 下拉列表
|
// 下拉列表
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
val countryTypeList = MutableLiveData<List<KeyValue>>(emptyList())
|
val countryTypeList = MutableLiveData<List<KeyValue>>(emptyList())
|
||||||
val serviceTypeList = MutableLiveData<List<KeyValue>>(emptyList())
|
val serviceTypeList = MutableLiveData<List<KeyValue>>(emptyList())
|
||||||
val statusList = MutableLiveData<List<KeyValue>>(emptyList())
|
|
||||||
val flightStatusList = MutableLiveData<List<KeyValue>>(emptyList())
|
val flightStatusList = MutableLiveData<List<KeyValue>>(emptyList())
|
||||||
val cmFlagList = MutableLiveData<List<KeyValue>>(emptyList())
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
// 选项定义(服务端入库/过滤用 code,详情接口返回中文名,回填时需反查)
|
// 选项定义(服务端入库/过滤用 code,详情接口返回中文名,回填时需反查)
|
||||||
@@ -140,7 +140,7 @@ class HbFlightEditViewModel : BaseViewModel() {
|
|||||||
fdest.value = bean.fdest
|
fdest.value = bean.fdest
|
||||||
countryType.value = toCode(countryTypeOptions, bean.countryType)
|
countryType.value = toCode(countryTypeOptions, bean.countryType)
|
||||||
serviceType.value = toCode(serviceTypeOptions, bean.serviceType)
|
serviceType.value = toCode(serviceTypeOptions, bean.serviceType)
|
||||||
status.value = toCode(statusOptions, bean.status)
|
status = toCode(statusOptions, bean.status)
|
||||||
scheduledTackOff.value = bean.scheduledTackOff
|
scheduledTackOff.value = bean.scheduledTackOff
|
||||||
estimatedTakeOff.value = bean.estimatedTakeOff
|
estimatedTakeOff.value = bean.estimatedTakeOff
|
||||||
actualTakeOff.value = bean.actualTakeOff
|
actualTakeOff.value = bean.actualTakeOff
|
||||||
@@ -149,9 +149,9 @@ class HbFlightEditViewModel : BaseViewModel() {
|
|||||||
actualArrival.value = bean.actualArrival
|
actualArrival.value = bean.actualArrival
|
||||||
standId.value = bean.standId
|
standId.value = bean.standId
|
||||||
registration.value = bean.registration
|
registration.value = bean.registration
|
||||||
prefix.value = bean.prefix
|
prefix = bean.prefix.noNull()
|
||||||
flightStatus.value = toCode(flightStatusOptions, bean.flightStatus)
|
flightStatus.value = toCode(flightStatusOptions, bean.flightStatus)
|
||||||
cmFlag.value = toCode(cmFlagOptions, bean.cmFlag)
|
cmFlag = toCode(cmFlagOptions, bean.cmFlag)
|
||||||
delayFreeText.value = bean.delayFreeText
|
delayFreeText.value = bean.delayFreeText
|
||||||
}
|
}
|
||||||
// 字典加载必须在编辑数据回填之后,保证 checkedValue 可用
|
// 字典加载必须在编辑数据回填之后,保证 checkedValue 可用
|
||||||
@@ -176,14 +176,8 @@ class HbFlightEditViewModel : BaseViewModel() {
|
|||||||
serviceTypeList.value =
|
serviceTypeList.value =
|
||||||
buildStaticList(serviceTypeOptions, if (isModify) serviceType.value else null)
|
buildStaticList(serviceTypeOptions, if (isModify) serviceType.value else null)
|
||||||
|
|
||||||
statusList.value =
|
|
||||||
buildStaticList(statusOptions, if (isModify) status.value else null)
|
|
||||||
|
|
||||||
flightStatusList.value =
|
flightStatusList.value =
|
||||||
buildStaticList(flightStatusOptions, if (isModify) flightStatus.value else null)
|
buildStaticList(flightStatusOptions, if (isModify) flightStatus.value else null)
|
||||||
|
|
||||||
cmFlagList.value =
|
|
||||||
buildStaticList(cmFlagOptions, if (isModify) cmFlag.value else null)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -214,6 +208,12 @@ class HbFlightEditViewModel : BaseViewModel() {
|
|||||||
if (flightNo.value.verifyNullOrEmpty("请输入航班号")) return
|
if (flightNo.value.verifyNullOrEmpty("请输入航班号")) return
|
||||||
if (fdep.value.verifyNullOrEmpty("请输入始发港")) return
|
if (fdep.value.verifyNullOrEmpty("请输入始发港")) return
|
||||||
if (fdest.value.verifyNullOrEmpty("请输入目的港")) return
|
if (fdest.value.verifyNullOrEmpty("请输入目的港")) return
|
||||||
|
if (countryType.value.verifyNullOrEmpty("请选择地区类型")) return
|
||||||
|
if (serviceType.value.verifyNullOrEmpty("请选择服务类型")) return
|
||||||
|
if (scheduledTackOff.value.verifyNullOrEmpty("请选择计划起飞时间")) return
|
||||||
|
if (estimatedTakeOff.value.verifyNullOrEmpty("请选择预计起飞时间")) return
|
||||||
|
if (scheduledArrival.value.verifyNullOrEmpty("请选择计划降落时间")) return
|
||||||
|
if (estimatedArrival.value.verifyNullOrEmpty("请选择预计降落时间")) return
|
||||||
|
|
||||||
val isModify = pageType.value == DetailsPageType.Modify
|
val isModify = pageType.value == DetailsPageType.Modify
|
||||||
val dep = fdep.value?.trim().noNull()
|
val dep = fdep.value?.trim().noNull()
|
||||||
@@ -231,7 +231,6 @@ class HbFlightEditViewModel : BaseViewModel() {
|
|||||||
"countryName" to countryTypeList.value
|
"countryName" to countryTypeList.value
|
||||||
?.firstOrNull { it.value == countryType.value }?.key,
|
?.firstOrNull { it.value == countryType.value }?.key,
|
||||||
"serviceType" to serviceType.value,
|
"serviceType" to serviceType.value,
|
||||||
"status" to status.value,
|
|
||||||
"scheduledTackOff" to scheduledTackOff.value,
|
"scheduledTackOff" to scheduledTackOff.value,
|
||||||
"estimatedTakeOff" to estimatedTakeOff.value,
|
"estimatedTakeOff" to estimatedTakeOff.value,
|
||||||
"actualTakeOff" to actualTakeOff.value,
|
"actualTakeOff" to actualTakeOff.value,
|
||||||
@@ -240,13 +239,14 @@ class HbFlightEditViewModel : BaseViewModel() {
|
|||||||
"actualArrival" to actualArrival.value,
|
"actualArrival" to actualArrival.value,
|
||||||
"standId" to standId.value?.trim(),
|
"standId" to standId.value?.trim(),
|
||||||
"registration" to registration.value?.trim(),
|
"registration" to registration.value?.trim(),
|
||||||
"prefix" to prefix.value?.trim(),
|
|
||||||
"flightStatus" to flightStatus.value,
|
"flightStatus" to flightStatus.value,
|
||||||
"cmFlag" to cmFlag.value,
|
|
||||||
"delayFreeText" to delayFreeText.value?.trim(),
|
"delayFreeText" to delayFreeText.value?.trim(),
|
||||||
)
|
)
|
||||||
if (isModify) {
|
if (isModify) {
|
||||||
params["fid"] = fid.toLongOrNull() ?: fid
|
params["fid"] = fid.toLongOrNull() ?: fid
|
||||||
|
params["status"] = status
|
||||||
|
params["prefix"] = prefix
|
||||||
|
params["cmFlag"] = cmFlag
|
||||||
}
|
}
|
||||||
|
|
||||||
launchLoadingCollect({
|
launchLoadingCollect({
|
||||||
|
|||||||
@@ -125,7 +125,7 @@
|
|||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<!-- 第3行:地区类型、服务类型、进出港 -->
|
<!-- 第3行:地区类型、服务类型、航班状态 -->
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
@@ -135,6 +135,7 @@
|
|||||||
<com.lukouguoji.module_base.ui.weight.data.layout.PadDataLayoutNew
|
<com.lukouguoji.module_base.ui.weight.data.layout.PadDataLayoutNew
|
||||||
hint='@{"请选择地区类型"}'
|
hint='@{"请选择地区类型"}'
|
||||||
list="@{viewModel.countryTypeList}"
|
list="@{viewModel.countryTypeList}"
|
||||||
|
required="@{true}"
|
||||||
title='@{"地区类型"}'
|
title='@{"地区类型"}'
|
||||||
titleLength="@{4}"
|
titleLength="@{4}"
|
||||||
type="@{DataLayoutType.SPINNER}"
|
type="@{DataLayoutType.SPINNER}"
|
||||||
@@ -146,6 +147,7 @@
|
|||||||
<com.lukouguoji.module_base.ui.weight.data.layout.PadDataLayoutNew
|
<com.lukouguoji.module_base.ui.weight.data.layout.PadDataLayoutNew
|
||||||
hint='@{"请选择服务类型"}'
|
hint='@{"请选择服务类型"}'
|
||||||
list="@{viewModel.serviceTypeList}"
|
list="@{viewModel.serviceTypeList}"
|
||||||
|
required="@{true}"
|
||||||
title='@{"服务类型"}'
|
title='@{"服务类型"}'
|
||||||
titleLength="@{4}"
|
titleLength="@{4}"
|
||||||
type="@{DataLayoutType.SPINNER}"
|
type="@{DataLayoutType.SPINNER}"
|
||||||
@@ -156,12 +158,12 @@
|
|||||||
android:layout_weight="1" />
|
android:layout_weight="1" />
|
||||||
|
|
||||||
<com.lukouguoji.module_base.ui.weight.data.layout.PadDataLayoutNew
|
<com.lukouguoji.module_base.ui.weight.data.layout.PadDataLayoutNew
|
||||||
hint='@{"请选择进出港"}'
|
hint='@{"请选择航班状态"}'
|
||||||
list="@{viewModel.statusList}"
|
list="@{viewModel.flightStatusList}"
|
||||||
title='@{"进出港"}'
|
title='@{"航班状态"}'
|
||||||
titleLength="@{4}"
|
titleLength="@{4}"
|
||||||
type="@{DataLayoutType.SPINNER}"
|
type="@{DataLayoutType.SPINNER}"
|
||||||
value='@={viewModel.status}'
|
value='@={viewModel.flightStatus}'
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginStart="15dp"
|
android:layout_marginStart="15dp"
|
||||||
@@ -178,6 +180,7 @@
|
|||||||
|
|
||||||
<com.lukouguoji.module_base.ui.weight.data.layout.PadDataLayoutNew
|
<com.lukouguoji.module_base.ui.weight.data.layout.PadDataLayoutNew
|
||||||
hint='@{"请选择计划起飞时间"}'
|
hint='@{"请选择计划起飞时间"}'
|
||||||
|
required="@{true}"
|
||||||
title='@{"计划起飞"}'
|
title='@{"计划起飞"}'
|
||||||
titleLength="@{4}"
|
titleLength="@{4}"
|
||||||
type="@{DataLayoutType.DATETIME}"
|
type="@{DataLayoutType.DATETIME}"
|
||||||
@@ -188,6 +191,7 @@
|
|||||||
|
|
||||||
<com.lukouguoji.module_base.ui.weight.data.layout.PadDataLayoutNew
|
<com.lukouguoji.module_base.ui.weight.data.layout.PadDataLayoutNew
|
||||||
hint='@{"请选择预计起飞时间"}'
|
hint='@{"请选择预计起飞时间"}'
|
||||||
|
required="@{true}"
|
||||||
title='@{"预计起飞"}'
|
title='@{"预计起飞"}'
|
||||||
titleLength="@{4}"
|
titleLength="@{4}"
|
||||||
type="@{DataLayoutType.DATETIME}"
|
type="@{DataLayoutType.DATETIME}"
|
||||||
@@ -219,6 +223,7 @@
|
|||||||
|
|
||||||
<com.lukouguoji.module_base.ui.weight.data.layout.PadDataLayoutNew
|
<com.lukouguoji.module_base.ui.weight.data.layout.PadDataLayoutNew
|
||||||
hint='@{"请选择计划降落时间"}'
|
hint='@{"请选择计划降落时间"}'
|
||||||
|
required="@{true}"
|
||||||
title='@{"计划降落"}'
|
title='@{"计划降落"}'
|
||||||
titleLength="@{4}"
|
titleLength="@{4}"
|
||||||
type="@{DataLayoutType.DATETIME}"
|
type="@{DataLayoutType.DATETIME}"
|
||||||
@@ -229,6 +234,7 @@
|
|||||||
|
|
||||||
<com.lukouguoji.module_base.ui.weight.data.layout.PadDataLayoutNew
|
<com.lukouguoji.module_base.ui.weight.data.layout.PadDataLayoutNew
|
||||||
hint='@{"请选择预计降落时间"}'
|
hint='@{"请选择预计降落时间"}'
|
||||||
|
required="@{true}"
|
||||||
title='@{"预计降落"}'
|
title='@{"预计降落"}'
|
||||||
titleLength="@{4}"
|
titleLength="@{4}"
|
||||||
type="@{DataLayoutType.DATETIME}"
|
type="@{DataLayoutType.DATETIME}"
|
||||||
@@ -251,7 +257,7 @@
|
|||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<!-- 第6行:机位、机号、运单前缀 -->
|
<!-- 第6行:机位、机号、延误原因 -->
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
@@ -280,49 +286,6 @@
|
|||||||
android:layout_marginStart="15dp"
|
android:layout_marginStart="15dp"
|
||||||
android:layout_weight="1" />
|
android:layout_weight="1" />
|
||||||
|
|
||||||
<com.lukouguoji.module_base.ui.weight.data.layout.PadDataLayoutNew
|
|
||||||
hint='@{"请输入运单前缀"}'
|
|
||||||
title='@{"运单前缀"}'
|
|
||||||
titleLength="@{4}"
|
|
||||||
type="@{DataLayoutType.INPUT}"
|
|
||||||
value='@={viewModel.prefix}'
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginStart="15dp"
|
|
||||||
android:layout_weight="1" />
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
<!-- 第7行:航班状态、货邮状态、延误原因 -->
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginTop="10dp"
|
|
||||||
android:orientation="horizontal">
|
|
||||||
|
|
||||||
<com.lukouguoji.module_base.ui.weight.data.layout.PadDataLayoutNew
|
|
||||||
hint='@{"请选择航班状态"}'
|
|
||||||
list="@{viewModel.flightStatusList}"
|
|
||||||
title='@{"航班状态"}'
|
|
||||||
titleLength="@{4}"
|
|
||||||
type="@{DataLayoutType.SPINNER}"
|
|
||||||
value='@={viewModel.flightStatus}'
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_weight="1" />
|
|
||||||
|
|
||||||
<com.lukouguoji.module_base.ui.weight.data.layout.PadDataLayoutNew
|
|
||||||
hint='@{"请选择货邮状态"}'
|
|
||||||
list="@{viewModel.cmFlagList}"
|
|
||||||
title='@{"货邮状态"}'
|
|
||||||
titleLength="@{4}"
|
|
||||||
type="@{DataLayoutType.SPINNER}"
|
|
||||||
value='@={viewModel.cmFlag}'
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginStart="15dp"
|
|
||||||
android:layout_weight="1" />
|
|
||||||
|
|
||||||
<com.lukouguoji.module_base.ui.weight.data.layout.PadDataLayoutNew
|
<com.lukouguoji.module_base.ui.weight.data.layout.PadDataLayoutNew
|
||||||
hint='@{"请输入延误原因"}'
|
hint='@{"请输入延误原因"}'
|
||||||
title='@{"延误原因"}'
|
title='@{"延误原因"}'
|
||||||
|
|||||||
Reference in New Issue
Block a user