feat: 航班管理列表新增增删改功能
- 列表页右上角新增加号入口,新增/编辑共用表单页(HbFlightEditActivity) - 列表项支持侧滑编辑、删除,删除使用 ConfirmDialogModel 二次确认 - 接入 /flt/saveFlight、/flt/updateFlight、/flt/delete 接口 - 编辑回填增加枚举中文名转代码处理;FlightBean 地区类型兼容中文值显示 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,53 @@
|
||||
package com.lukouguoji.hangban.page.edit
|
||||
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.os.Bundle
|
||||
import com.lukouguoji.hangban.R
|
||||
import com.lukouguoji.hangban.databinding.ActivityHbFlightEditBinding
|
||||
import com.lukouguoji.module_base.base.BaseBindingActivity
|
||||
import com.lukouguoji.module_base.common.Constant
|
||||
import com.lukouguoji.module_base.common.DetailsPageType
|
||||
import com.lukouguoji.module_base.ktx.setUpperCaseAlphanumericFilter
|
||||
|
||||
class HbFlightEditActivity :
|
||||
BaseBindingActivity<ActivityHbFlightEditBinding, HbFlightEditViewModel>() {
|
||||
|
||||
override fun layoutId() = R.layout.activity_hb_flight_edit
|
||||
|
||||
override fun viewModelClass() = HbFlightEditViewModel::class.java
|
||||
|
||||
override fun initOnCreate(savedInstanceState: Bundle?) {
|
||||
binding.viewModel = viewModel
|
||||
|
||||
binding.flightNoInput.et.setUpperCaseAlphanumericFilter()
|
||||
binding.fdepInput.et.setUpperCaseAlphanumericFilter()
|
||||
binding.fdestInput.et.setUpperCaseAlphanumericFilter()
|
||||
binding.registrationInput.et.setUpperCaseAlphanumericFilter()
|
||||
|
||||
viewModel.initOnCreated(intent)
|
||||
|
||||
// 动态设置标题(必须在 initOnCreated 之后,pageType 已从 Intent 解析)
|
||||
val title = when (viewModel.pageType.value) {
|
||||
DetailsPageType.Modify -> "编辑航班"
|
||||
else -> "新增航班"
|
||||
}
|
||||
setBackArrow(title)
|
||||
}
|
||||
|
||||
companion object {
|
||||
/**
|
||||
* fid 为空表示新增,非空表示编辑
|
||||
*/
|
||||
@JvmStatic
|
||||
fun start(context: Context, fid: String = "") {
|
||||
val pageType =
|
||||
if (fid.isEmpty()) DetailsPageType.Add.name else DetailsPageType.Modify.name
|
||||
context.startActivity(
|
||||
Intent(context, HbFlightEditActivity::class.java)
|
||||
.putExtra(Constant.Key.PAGE_TYPE, pageType)
|
||||
.putExtra(Constant.Key.ID, fid)
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,280 @@
|
||||
package com.lukouguoji.hangban.page.edit
|
||||
|
||||
import android.content.Intent
|
||||
import android.view.View
|
||||
import androidx.lifecycle.MutableLiveData
|
||||
import androidx.lifecycle.viewModelScope
|
||||
import com.lukouguoji.module_base.base.BaseViewModel
|
||||
import com.lukouguoji.module_base.common.Constant
|
||||
import com.lukouguoji.module_base.common.ConstantEvent
|
||||
import com.lukouguoji.module_base.common.DetailsPageType
|
||||
import com.lukouguoji.module_base.http.net.NetApply
|
||||
import com.lukouguoji.module_base.impl.FlowBus
|
||||
import com.lukouguoji.module_base.ktx.formatDate
|
||||
import com.lukouguoji.module_base.ktx.launchLoadingCollect
|
||||
import com.lukouguoji.module_base.ktx.noNull
|
||||
import com.lukouguoji.module_base.ktx.showToast
|
||||
import com.lukouguoji.module_base.ktx.toRequestBody
|
||||
import com.lukouguoji.module_base.ktx.verifyNullOrEmpty
|
||||
import com.lukouguoji.module_base.util.DictUtils
|
||||
import dev.DevUtils
|
||||
import dev.utils.app.info.KeyValue
|
||||
import dev.utils.common.DateUtils
|
||||
import kotlinx.coroutines.launch
|
||||
|
||||
class HbFlightEditViewModel : BaseViewModel() {
|
||||
|
||||
val pageType = MutableLiveData(DetailsPageType.Add)
|
||||
|
||||
// 航班主键(编辑模式)
|
||||
private var fid = ""
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// 表单字段
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
val flightDate = MutableLiveData("")
|
||||
val flightNo = MutableLiveData("")
|
||||
val aircraftCode = MutableLiveData("")
|
||||
val fdep = MutableLiveData("")
|
||||
val jtz = MutableLiveData("")
|
||||
val fdest = MutableLiveData("")
|
||||
val countryType = MutableLiveData("")
|
||||
val serviceType = MutableLiveData("")
|
||||
val status = MutableLiveData("")
|
||||
val scheduledTackOff = MutableLiveData("")
|
||||
val estimatedTakeOff = MutableLiveData("")
|
||||
val actualTakeOff = MutableLiveData("")
|
||||
val scheduledArrival = MutableLiveData("")
|
||||
val estimatedArrival = MutableLiveData("")
|
||||
val actualArrival = MutableLiveData("")
|
||||
val standId = MutableLiveData("")
|
||||
val registration = MutableLiveData("")
|
||||
val prefix = MutableLiveData("")
|
||||
val flightStatus = MutableLiveData("")
|
||||
val cmFlag = MutableLiveData("")
|
||||
val delayFreeText = MutableLiveData("")
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// 下拉列表
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
val countryTypeList = MutableLiveData<List<KeyValue>>(emptyList())
|
||||
val serviceTypeList = MutableLiveData<List<KeyValue>>(emptyList())
|
||||
val statusList = MutableLiveData<List<KeyValue>>(emptyList())
|
||||
val flightStatusList = MutableLiveData<List<KeyValue>>(emptyList())
|
||||
val cmFlagList = MutableLiveData<List<KeyValue>>(emptyList())
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// 选项定义(服务端入库/过滤用 code,详情接口返回中文名,回填时需反查)
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
private val countryTypeOptions = listOf(
|
||||
KeyValue("国内", "0"),
|
||||
KeyValue("国际", "1"),
|
||||
KeyValue("地区", "2"),
|
||||
KeyValue("混合", "3"),
|
||||
)
|
||||
|
||||
private val serviceTypeOptions = listOf(
|
||||
KeyValue("客机", "0"),
|
||||
KeyValue("货机", "1"),
|
||||
KeyValue("卡车", "2"),
|
||||
)
|
||||
|
||||
private val statusOptions = listOf(
|
||||
KeyValue("出港", "0"),
|
||||
KeyValue("进港", "1"),
|
||||
)
|
||||
|
||||
private val flightStatusOptions = listOf(
|
||||
KeyValue("正常", "0"),
|
||||
KeyValue("登机", "1"),
|
||||
KeyValue("登机结束", "2"),
|
||||
KeyValue("起飞", "3"),
|
||||
KeyValue("到达", "4"),
|
||||
KeyValue("取消", "5"),
|
||||
KeyValue("备降", "6"),
|
||||
KeyValue("删除发布", "7"),
|
||||
KeyValue("延误", "8"),
|
||||
KeyValue("未知", "9"),
|
||||
)
|
||||
|
||||
private val cmFlagOptions = listOf(
|
||||
KeyValue("有货邮", "0"),
|
||||
KeyValue("无货邮", "1"),
|
||||
)
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// 方法区
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
fun initOnCreated(intent: Intent) {
|
||||
pageType.value =
|
||||
if (intent.getStringExtra(Constant.Key.PAGE_TYPE) == DetailsPageType.Modify.name)
|
||||
DetailsPageType.Modify else DetailsPageType.Add
|
||||
fid = intent.getStringExtra(Constant.Key.ID) ?: ""
|
||||
|
||||
if (pageType.value == DetailsPageType.Modify && fid.isNotEmpty()) {
|
||||
loadDetails()
|
||||
} else {
|
||||
flightDate.value = DateUtils.getCurrentTime().formatDate()
|
||||
loadDictLists()
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑模式:加载航班详情
|
||||
*/
|
||||
private fun loadDetails() {
|
||||
launchLoadingCollect({
|
||||
NetApply.api.getFlightDetails(fid)
|
||||
}) {
|
||||
onSuccess = {
|
||||
it.data?.let { bean ->
|
||||
flightDate.value = bean.fdate
|
||||
flightNo.value = bean.fno
|
||||
aircraftCode.value = bean.aircraftCode
|
||||
fdep.value = bean.fdep
|
||||
jtz.value = bean.jtz
|
||||
fdest.value = bean.fdest
|
||||
countryType.value = toCode(countryTypeOptions, bean.countryType)
|
||||
serviceType.value = toCode(serviceTypeOptions, bean.serviceType)
|
||||
status.value = toCode(statusOptions, bean.status)
|
||||
scheduledTackOff.value = bean.scheduledTackOff
|
||||
estimatedTakeOff.value = bean.estimatedTakeOff
|
||||
actualTakeOff.value = bean.actualTakeOff
|
||||
scheduledArrival.value = bean.scheduledArrival
|
||||
estimatedArrival.value = bean.estimatedArrival
|
||||
actualArrival.value = bean.actualArrival
|
||||
standId.value = bean.standId
|
||||
registration.value = bean.registration
|
||||
prefix.value = bean.prefix
|
||||
flightStatus.value = toCode(flightStatusOptions, bean.flightStatus)
|
||||
cmFlag.value = toCode(cmFlagOptions, bean.cmFlag)
|
||||
delayFreeText.value = bean.delayFreeText
|
||||
}
|
||||
// 字典加载必须在编辑数据回填之后,保证 checkedValue 可用
|
||||
loadDictLists()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 加载下拉列表(编辑模式传 checkedValue 置顶选中项)
|
||||
*/
|
||||
private fun loadDictLists() {
|
||||
val isModify = pageType.value == DetailsPageType.Modify
|
||||
|
||||
DictUtils.getCountryTypeList(
|
||||
addAll = false,
|
||||
checkedValue = if (isModify) countryType.value else null
|
||||
) {
|
||||
countryTypeList.postValue(if (isModify) it else listOf(KeyValue("", "")) + it)
|
||||
}
|
||||
|
||||
serviceTypeList.value =
|
||||
buildStaticList(serviceTypeOptions, if (isModify) serviceType.value else null)
|
||||
|
||||
statusList.value =
|
||||
buildStaticList(statusOptions, if (isModify) status.value else null)
|
||||
|
||||
flightStatusList.value =
|
||||
buildStaticList(flightStatusOptions, if (isModify) flightStatus.value else null)
|
||||
|
||||
cmFlagList.value =
|
||||
buildStaticList(cmFlagOptions, if (isModify) cmFlag.value else null)
|
||||
}
|
||||
|
||||
/**
|
||||
* 值转 code:详情接口可能返回中文名(如“国际”“客机”),统一转为 code 用于回填与提交
|
||||
*/
|
||||
private fun toCode(options: List<KeyValue>, raw: String?): String {
|
||||
if (raw.isNullOrEmpty()) return ""
|
||||
return options.firstOrNull { it.value == raw }?.value
|
||||
?: options.firstOrNull { it.key == raw }?.value
|
||||
?: raw
|
||||
}
|
||||
|
||||
/**
|
||||
* 静态下拉列表:新增模式首位置空项;编辑模式将选中项置顶
|
||||
*/
|
||||
private fun buildStaticList(list: List<KeyValue>, checkedValue: String?): List<KeyValue> {
|
||||
if (checkedValue.isNullOrEmpty()) {
|
||||
return listOf(KeyValue("", "")) + list
|
||||
}
|
||||
return list.filter { it.value == checkedValue } + list.filter { it.value != checkedValue }
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存 点击
|
||||
*/
|
||||
fun onSaveClick(view: View) {
|
||||
if (flightDate.value.verifyNullOrEmpty("请选择航班日期")) return
|
||||
if (flightNo.value.verifyNullOrEmpty("请输入航班号")) return
|
||||
if (fdep.value.verifyNullOrEmpty("请输入始发港")) return
|
||||
if (fdest.value.verifyNullOrEmpty("请输入目的港")) return
|
||||
|
||||
val isModify = pageType.value == DetailsPageType.Modify
|
||||
val dep = fdep.value?.trim().noNull()
|
||||
val dest = fdest.value?.trim().noNull()
|
||||
|
||||
val params = mutableMapOf<String, Any?>(
|
||||
"fdate" to flightDate.value,
|
||||
"fno" to flightNo.value?.trim(),
|
||||
"aircraftCode" to aircraftCode.value?.trim(),
|
||||
"fdep" to dep,
|
||||
"jtz" to jtz.value?.trim(),
|
||||
"fdest" to dest,
|
||||
"range" to "$dep-$dest",
|
||||
"countryType" to countryType.value,
|
||||
"countryName" to countryTypeList.value
|
||||
?.firstOrNull { it.value == countryType.value }?.key,
|
||||
"serviceType" to serviceType.value,
|
||||
"status" to status.value,
|
||||
"scheduledTackOff" to scheduledTackOff.value,
|
||||
"estimatedTakeOff" to estimatedTakeOff.value,
|
||||
"actualTakeOff" to actualTakeOff.value,
|
||||
"scheduledArrival" to scheduledArrival.value,
|
||||
"estimatedArrival" to estimatedArrival.value,
|
||||
"actualArrival" to actualArrival.value,
|
||||
"standId" to standId.value?.trim(),
|
||||
"registration" to registration.value?.trim(),
|
||||
"prefix" to prefix.value?.trim(),
|
||||
"flightStatus" to flightStatus.value,
|
||||
"cmFlag" to cmFlag.value,
|
||||
"delayFreeText" to delayFreeText.value?.trim(),
|
||||
)
|
||||
if (isModify) {
|
||||
params["fid"] = fid.toLongOrNull() ?: fid
|
||||
}
|
||||
|
||||
launchLoadingCollect({
|
||||
if (isModify) {
|
||||
NetApply.api.updateFlight(params.toRequestBody())
|
||||
} else {
|
||||
NetApply.api.saveFlight(params.toRequestBody())
|
||||
}
|
||||
}) {
|
||||
onSuccess = {
|
||||
if (it.verifySuccess()) {
|
||||
showToast(if (isModify) "修改成功" else "新增成功")
|
||||
viewModelScope.launch {
|
||||
FlowBus.with<String>(ConstantEvent.EVENT_REFRESH).emit("refresh")
|
||||
}
|
||||
DevUtils.getTopActivity().finish()
|
||||
} else {
|
||||
showToast(it.msg.noNull("保存失败"))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 取消 点击
|
||||
*/
|
||||
fun onCancelClick(view: View) {
|
||||
DevUtils.getTopActivity().finish()
|
||||
}
|
||||
|
||||
}
|
||||
@@ -5,6 +5,9 @@ import com.alibaba.android.arouter.facade.annotation.Route
|
||||
import com.lukouguoji.hangban.R
|
||||
import com.lukouguoji.hangban.databinding.ActivityHbQueryListBinding
|
||||
import com.lukouguoji.module_base.base.BaseBindingActivity
|
||||
import com.lukouguoji.module_base.common.ConstantEvent
|
||||
import com.lukouguoji.module_base.impl.FlowBus
|
||||
import com.lukouguoji.module_base.impl.observe
|
||||
import com.lukouguoji.module_base.ktx.addOnItemClickListener
|
||||
import com.lukouguoji.module_base.ktx.getLifecycleOwner
|
||||
import com.lukouguoji.module_base.router.ARouterConstants
|
||||
@@ -26,6 +29,11 @@ class HbQueryListActivity :
|
||||
|
||||
binding.rv.addOnItemClickListener(viewModel)
|
||||
|
||||
// 新增、编辑保存后刷新列表
|
||||
FlowBus.with<String>(ConstantEvent.EVENT_REFRESH).observe(this) {
|
||||
viewModel.refresh()
|
||||
}
|
||||
|
||||
viewModel.refresh()
|
||||
}
|
||||
|
||||
|
||||
@@ -28,6 +28,8 @@ class HbQueryListViewHolder(view: View) :
|
||||
}
|
||||
|
||||
notifyItemClick(position, binding.ll)
|
||||
notifyItemClick(position, binding.tvModify)
|
||||
notifyItemClick(position, binding.tvDelete)
|
||||
}
|
||||
|
||||
private fun setTextColorRecursive(view: View, color: Int) {
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.lukouguoji.hangban.page.query.list
|
||||
import androidx.lifecycle.MutableLiveData
|
||||
import com.alibaba.android.arouter.launcher.ARouter
|
||||
import com.lukouguoji.hangban.R
|
||||
import com.lukouguoji.hangban.page.edit.HbFlightEditActivity
|
||||
import com.lukouguoji.module_base.base.BasePageViewModel
|
||||
import com.lukouguoji.module_base.bean.FlightBean
|
||||
import com.lukouguoji.module_base.common.Constant
|
||||
@@ -10,9 +11,13 @@ import com.lukouguoji.module_base.http.net.NetApply
|
||||
import com.lukouguoji.module_base.ktx.commonAdapter
|
||||
import com.lukouguoji.module_base.ktx.formatDate
|
||||
import com.lukouguoji.module_base.ktx.launchLoadingCollect
|
||||
import com.lukouguoji.module_base.ktx.noNull
|
||||
import com.lukouguoji.module_base.ktx.showToast
|
||||
import com.lukouguoji.module_base.ktx.toRequestBody
|
||||
import com.lukouguoji.module_base.model.ConfirmDialogModel
|
||||
import com.lukouguoji.module_base.router.ARouterConstants
|
||||
import com.lukouguoji.module_base.util.DictUtils
|
||||
import dev.DevUtils
|
||||
import dev.utils.app.info.KeyValue
|
||||
import dev.utils.common.DateUtils
|
||||
|
||||
@@ -80,11 +85,55 @@ class HbQueryListViewModel : BasePageViewModel() {
|
||||
return "${d ?: ""}-${a ?: ""}"
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增 点击
|
||||
*/
|
||||
fun addClick() {
|
||||
HbFlightEditActivity.start(DevUtils.getTopActivity())
|
||||
}
|
||||
|
||||
override fun onItemClick(position: Int, type: Int) {
|
||||
val bean = pageModel.rv!!.commonAdapter()!!.getItem(position) as FlightBean
|
||||
ARouter.getInstance().build(ARouterConstants.ACTIVITY_URL_FLIGHT_QUERY_DETAILS)
|
||||
.withString(Constant.Key.ID, bean.fid)
|
||||
.navigation()
|
||||
when (type) {
|
||||
R.id.tv_modify -> {
|
||||
HbFlightEditActivity.start(DevUtils.getTopActivity(), bean.fid)
|
||||
}
|
||||
|
||||
R.id.tv_delete -> {
|
||||
ConfirmDialogModel(
|
||||
message = "是否确认删除航班【${bean.fno}】?",
|
||||
) {
|
||||
onDelete(bean)
|
||||
}.show(DevUtils.getTopActivity())
|
||||
}
|
||||
|
||||
else -> {
|
||||
ARouter.getInstance().build(ARouterConstants.ACTIVITY_URL_FLIGHT_QUERY_DETAILS)
|
||||
.withString(Constant.Key.ID, bean.fid)
|
||||
.navigation()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除航班
|
||||
*/
|
||||
private fun onDelete(bean: FlightBean) {
|
||||
launchLoadingCollect({
|
||||
NetApply.api.deleteFlightList(
|
||||
listOf(mapOf("fid" to bean.fid)).toRequestBody()
|
||||
)
|
||||
}) {
|
||||
onSuccess = {
|
||||
if (it.verifySuccess()) {
|
||||
// 服务端删除接口的 msg 为“修改成功”,此处固定提示删除成功
|
||||
showToast("删除成功")
|
||||
refresh()
|
||||
} else {
|
||||
showToast(it.msg.noNull("删除失败"))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -18,6 +18,11 @@
|
||||
android:configChanges="orientation|keyboardHidden"
|
||||
android:screenOrientation="userLandscape"
|
||||
android:exported="false" />
|
||||
<activity
|
||||
android:name=".page.edit.HbFlightEditActivity"
|
||||
android:configChanges="orientation|keyboardHidden"
|
||||
android:screenOrientation="userLandscape"
|
||||
android:exported="false" />
|
||||
<activity
|
||||
android:name=".MainActivity"
|
||||
android:configChanges="orientation|keyboardHidden"
|
||||
|
||||
377
module_hangban/src/main/res/layout/activity_hb_flight_edit.xml
Normal file
377
module_hangban/src/main/res/layout/activity_hb_flight_edit.xml
Normal file
@@ -0,0 +1,377 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layout xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<data>
|
||||
|
||||
<import type="com.lukouguoji.module_base.ui.weight.data.layout.DataLayoutType" />
|
||||
|
||||
<variable
|
||||
name="viewModel"
|
||||
type="com.lukouguoji.hangban.page.edit.HbFlightEditViewModel" />
|
||||
</data>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/color_f2"
|
||||
android:orientation="vertical">
|
||||
|
||||
<include layout="@layout/title_tool_bar" />
|
||||
|
||||
<ScrollView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1"
|
||||
android:fillViewport="true">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:padding="15dp">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/bg_white_radius_8"
|
||||
android:orientation="vertical"
|
||||
android:padding="8dp">
|
||||
|
||||
<!-- 第1行:航班日期、航班号、机型 -->
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<com.lukouguoji.module_base.ui.weight.data.layout.PadDataLayoutNew
|
||||
hint='@{"请选择航班日期"}'
|
||||
required="@{true}"
|
||||
title='@{"航班日期"}'
|
||||
titleLength="@{4}"
|
||||
type="@{DataLayoutType.DATE}"
|
||||
value='@={viewModel.flightDate}'
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1" />
|
||||
|
||||
<com.lukouguoji.module_base.ui.weight.data.layout.PadDataLayoutNew
|
||||
android:id="@+id/flightNoInput"
|
||||
hint='@{"请输入航班号"}'
|
||||
required="@{true}"
|
||||
title='@{"航班号"}'
|
||||
titleLength="@{4}"
|
||||
type="@{DataLayoutType.INPUT}"
|
||||
value='@={viewModel.flightNo}'
|
||||
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
|
||||
hint='@{"请输入机型"}'
|
||||
title='@{"机型"}'
|
||||
titleLength="@{4}"
|
||||
type="@{DataLayoutType.INPUT}"
|
||||
value='@={viewModel.aircraftCode}'
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="15dp"
|
||||
android:layout_weight="1" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<!-- 第2行:始发港、经停港、目的港 -->
|
||||
<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
|
||||
android:id="@+id/fdepInput"
|
||||
hint='@{"请输入始发港"}'
|
||||
required="@{true}"
|
||||
title='@{"始发港"}'
|
||||
titleLength="@{4}"
|
||||
type="@{DataLayoutType.INPUT}"
|
||||
value='@={viewModel.fdep}'
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1" />
|
||||
|
||||
<com.lukouguoji.module_base.ui.weight.data.layout.PadDataLayoutNew
|
||||
hint='@{"多个用英文逗号分隔"}'
|
||||
title='@{"经停港"}'
|
||||
titleLength="@{4}"
|
||||
type="@{DataLayoutType.INPUT}"
|
||||
value='@={viewModel.jtz}'
|
||||
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
|
||||
android:id="@+id/fdestInput"
|
||||
hint='@{"请输入目的港"}'
|
||||
required="@{true}"
|
||||
title='@{"目的港"}'
|
||||
titleLength="@{4}"
|
||||
type="@{DataLayoutType.INPUT}"
|
||||
value='@={viewModel.fdest}'
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="15dp"
|
||||
android:layout_weight="1" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<!-- 第3行:地区类型、服务类型、进出港 -->
|
||||
<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.countryTypeList}"
|
||||
title='@{"地区类型"}'
|
||||
titleLength="@{4}"
|
||||
type="@{DataLayoutType.SPINNER}"
|
||||
value='@={viewModel.countryType}'
|
||||
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.serviceTypeList}"
|
||||
title='@{"服务类型"}'
|
||||
titleLength="@{4}"
|
||||
type="@{DataLayoutType.SPINNER}"
|
||||
value='@={viewModel.serviceType}'
|
||||
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
|
||||
hint='@{"请选择进出港"}'
|
||||
list="@{viewModel.statusList}"
|
||||
title='@{"进出港"}'
|
||||
titleLength="@{4}"
|
||||
type="@{DataLayoutType.SPINNER}"
|
||||
value='@={viewModel.status}'
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="15dp"
|
||||
android:layout_weight="1" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<!-- 第4行:计划起飞、预计起飞、实际起飞 -->
|
||||
<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='@{"请选择计划起飞时间"}'
|
||||
title='@{"计划起飞"}'
|
||||
titleLength="@{4}"
|
||||
type="@{DataLayoutType.DATETIME}"
|
||||
value='@={viewModel.scheduledTackOff}'
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1" />
|
||||
|
||||
<com.lukouguoji.module_base.ui.weight.data.layout.PadDataLayoutNew
|
||||
hint='@{"请选择预计起飞时间"}'
|
||||
title='@{"预计起飞"}'
|
||||
titleLength="@{4}"
|
||||
type="@{DataLayoutType.DATETIME}"
|
||||
value='@={viewModel.estimatedTakeOff}'
|
||||
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
|
||||
hint='@{"请选择实际起飞时间"}'
|
||||
title='@{"实际起飞"}'
|
||||
titleLength="@{4}"
|
||||
type="@{DataLayoutType.DATETIME}"
|
||||
value='@={viewModel.actualTakeOff}'
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="15dp"
|
||||
android:layout_weight="1" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<!-- 第5行:计划降落、预计降落、实际降落 -->
|
||||
<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='@{"请选择计划降落时间"}'
|
||||
title='@{"计划降落"}'
|
||||
titleLength="@{4}"
|
||||
type="@{DataLayoutType.DATETIME}"
|
||||
value='@={viewModel.scheduledArrival}'
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1" />
|
||||
|
||||
<com.lukouguoji.module_base.ui.weight.data.layout.PadDataLayoutNew
|
||||
hint='@{"请选择预计降落时间"}'
|
||||
title='@{"预计降落"}'
|
||||
titleLength="@{4}"
|
||||
type="@{DataLayoutType.DATETIME}"
|
||||
value='@={viewModel.estimatedArrival}'
|
||||
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
|
||||
hint='@{"请选择实际降落时间"}'
|
||||
title='@{"实际降落"}'
|
||||
titleLength="@{4}"
|
||||
type="@{DataLayoutType.DATETIME}"
|
||||
value='@={viewModel.actualArrival}'
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="15dp"
|
||||
android:layout_weight="1" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<!-- 第6行:机位、机号、运单前缀 -->
|
||||
<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='@{"请输入机位"}'
|
||||
title='@{"机位"}'
|
||||
titleLength="@{4}"
|
||||
type="@{DataLayoutType.INPUT}"
|
||||
value='@={viewModel.standId}'
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1" />
|
||||
|
||||
<com.lukouguoji.module_base.ui.weight.data.layout.PadDataLayoutNew
|
||||
android:id="@+id/registrationInput"
|
||||
hint='@{"请输入机号"}'
|
||||
title='@{"机号"}'
|
||||
titleLength="@{4}"
|
||||
type="@{DataLayoutType.INPUT}"
|
||||
value='@={viewModel.registration}'
|
||||
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
|
||||
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
|
||||
hint='@{"请输入延误原因"}'
|
||||
title='@{"延误原因"}'
|
||||
titleLength="@{4}"
|
||||
type="@{DataLayoutType.INPUT}"
|
||||
value='@={viewModel.delayFreeText}'
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="15dp"
|
||||
android:layout_weight="1" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<!-- 底部操作栏 -->
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:orientation="horizontal"
|
||||
android:padding="15dp">
|
||||
|
||||
<TextView
|
||||
android:layout_width="150dp"
|
||||
android:layout_height="50dp"
|
||||
android:layout_marginEnd="30dp"
|
||||
android:background="@drawable/bg_primary_radius_4"
|
||||
android:gravity="center"
|
||||
android:onClick="@{viewModel::onCancelClick}"
|
||||
android:text="取消"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="18sp" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="150dp"
|
||||
android:layout_height="50dp"
|
||||
android:background="@drawable/bg_primary_radius_4"
|
||||
android:gravity="center"
|
||||
android:onClick="@{viewModel::onSaveClick}"
|
||||
android:text="保存"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="18sp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</ScrollView>
|
||||
|
||||
</LinearLayout>
|
||||
</layout>
|
||||
@@ -104,6 +104,14 @@
|
||||
android:padding="2dp"
|
||||
android:src="@drawable/img_search" />
|
||||
|
||||
<!-- 新增按钮 -->
|
||||
<ImageView
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="40dp"
|
||||
android:layout_marginStart="16dp"
|
||||
android:onClick="@{()-> viewModel.addClick()}"
|
||||
android:src="@drawable/img_add" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
@@ -10,16 +10,26 @@
|
||||
type="com.lukouguoji.module_base.bean.FlightBean" />
|
||||
</data>
|
||||
|
||||
<androidx.appcompat.widget.LinearLayoutCompat
|
||||
android:id="@+id/ll"
|
||||
<!-- 外层容器承载间距,使侧滑按钮紧贴卡片(参考 item_int_imp_pick_up_record) -->
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginHorizontal="15dp"
|
||||
android:layout_marginVertical="5dp"
|
||||
android:background="@drawable/bg_item"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal"
|
||||
android:padding="10dp">
|
||||
android:orientation="vertical">
|
||||
|
||||
<com.mcxtzhang.swipemenulib.SwipeMenuLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<androidx.appcompat.widget.LinearLayoutCompat
|
||||
android:id="@+id/ll"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/bg_item"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal"
|
||||
android:padding="10dp">
|
||||
|
||||
<!-- 左侧飞机图标 -->
|
||||
<ImageView
|
||||
@@ -317,5 +327,28 @@
|
||||
android:layout_marginLeft="10dp"
|
||||
android:src="@drawable/img_pda_right" />
|
||||
|
||||
</androidx.appcompat.widget.LinearLayoutCompat>
|
||||
</androidx.appcompat.widget.LinearLayoutCompat>
|
||||
|
||||
<!-- 侧滑操作按钮 -->
|
||||
<androidx.appcompat.widget.LinearLayoutCompat
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_modify"
|
||||
style="@style/tv_item_action"
|
||||
android:background="@color/colorPrimary"
|
||||
android:text="编辑" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_delete"
|
||||
style="@style/tv_item_action"
|
||||
android:background="#df253c"
|
||||
android:text="删除" />
|
||||
|
||||
</androidx.appcompat.widget.LinearLayoutCompat>
|
||||
|
||||
</com.mcxtzhang.swipemenulib.SwipeMenuLayout>
|
||||
|
||||
</LinearLayout>
|
||||
</layout>
|
||||
|
||||
Reference in New Issue
Block a user