feat: 国际出港装载列表项加航程及始发站/目的站筛选

列表项改为5列并新增航程(range 为空时回退始发港-目的港拼接);
搜索区参考电报生成接口,填航班日期+号联动查询,始发站可下拉、
目的站自动填充只读,dep/dest 作为筛选传给列表接口。

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-06-20 12:19:51 +08:00
parent 608f1af1f4
commit 3fedef27a7
5 changed files with 172 additions and 28 deletions

View File

@@ -17,6 +17,7 @@ import com.lukouguoji.module_base.impl.FlowBus
import com.lukouguoji.module_base.ktx.commonAdapter
import com.lukouguoji.module_base.ktx.launchCollect
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.ScanModel
@@ -34,6 +35,77 @@ class IntExpLoadViewModel : BasePageViewModel() {
val flightDate = MutableLiveData<String>(DateUtils.getCurrentTime().formatDate()) // 航班日期
val flightNo = MutableLiveData("") // 航班号
val waybillNo = MutableLiveData("") // 运单号
val depPort = MutableLiveData("") // 始发站(下拉选择)
val depPortList = MutableLiveData<List<KeyValue>>(emptyList()) // 始发站下拉列表(始发港 + 经停港)
val destPort = MutableLiveData("") // 目的站(航班查询自动填充,不可编辑)
// ========== 航班级联查询 ==========
private var lastQueriedFlight = "" // 避免重复查询
/**
* 航班日期输入完成回调
*/
fun onFlightDateInputComplete() {
lastQueriedFlight = ""
queryFlightIfReady()
}
/**
* 航班号输入完成回调
*/
fun onFlightNoInputComplete() {
queryFlightIfReady()
}
/**
* 航班日期 + 航班号 均有值时,查询航班并填充始发站/目的站
* 参考「电报生成」(/flt/intFlight):始发站下拉(始发港+经停港),目的站自动填充且只读
*/
private fun queryFlightIfReady() {
val fdate = flightDate.value
val fno = flightNo.value
if (fdate.isNullOrEmpty() || fno.isNullOrEmpty()) return
val key = "$fdate-$fno"
if (key == lastQueriedFlight) return
lastQueriedFlight = key
launchCollect({
NetApply.api.getGjFlightBean(
mapOf(
"fdate" to fdate,
"fno" to fno,
"ieFlag" to "E", // 出港
).toRequestBody()
)
}) {
onSuccess = {
if (it.verifySuccess() && it.data != null) {
val flight = it.data!!
// 目的站:航班查询返回,自动填充
destPort.value = flight.fdest.noNull()
// 始发站下拉:始发港 + 经停港(可逗号分隔多个)
val list = mutableListOf(KeyValue(flight.fdep.noNull(), flight.fdep.noNull()))
flight.jtz.split(",").forEach { stop ->
val s = stop.trim()
if (s.isNotEmpty()) list.add(KeyValue(s, s))
}
depPortList.value = list
depPort.value = flight.fdep.noNull()
} else {
depPortList.value = emptyList()
depPort.value = ""
destPort.value = ""
}
}
onFailed = { _, _ ->
depPortList.value = emptyList()
depPort.value = ""
destPort.value = ""
}
}
}
// ========== 统计信息 ==========
val totalCount = MutableLiveData("0") // 合计票数
@@ -199,6 +271,8 @@ class IntExpLoadViewModel : BasePageViewModel() {
fdate = flightDate.value?.ifEmpty { null },
fno = flightNo.value?.ifEmpty { null },
wbNo = waybillNo.value?.ifEmpty { null },
dep = depPort.value?.ifEmpty { null },
dest = destPort.value?.ifEmpty { null },
pageNum = pageModel.page,
pageSize = pageModel.limit
)
@@ -210,7 +284,9 @@ class IntExpLoadViewModel : BasePageViewModel() {
val totalParams = GjcCheckInPage(
fdate = flightDate.value?.ifEmpty { null },
fno = flightNo.value?.ifEmpty { null },
wbNo = waybillNo.value?.ifEmpty { null }
wbNo = waybillNo.value?.ifEmpty { null },
dep = depPort.value?.ifEmpty { null },
dest = destPort.value?.ifEmpty { null }
).toRequestBody()
// 获取列表 (带Loading)