Compare commits
2 Commits
794c873173
...
d876ea4640
| Author | SHA1 | Date | |
|---|---|---|---|
| d876ea4640 | |||
| 657be255b0 |
@@ -11,6 +11,7 @@ import com.lukouguoji.module_base.ktx.launchLoadingCollect
|
|||||||
import com.lukouguoji.module_base.ktx.noNull
|
import com.lukouguoji.module_base.ktx.noNull
|
||||||
import com.lukouguoji.module_base.ktx.showToast
|
import com.lukouguoji.module_base.ktx.showToast
|
||||||
import com.lukouguoji.module_base.ktx.toRequestBody
|
import com.lukouguoji.module_base.ktx.toRequestBody
|
||||||
|
import com.lukouguoji.module_base.util.DictUtils
|
||||||
import dev.DevUtils
|
import dev.DevUtils
|
||||||
import dev.utils.app.info.KeyValue
|
import dev.utils.app.info.KeyValue
|
||||||
|
|
||||||
@@ -29,16 +30,8 @@ class UldEditViewModel : BaseViewModel() {
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
// 所属航司下拉列表(mock,后续替换为接口)
|
// 所属航司下拉列表(数据源:POST /typeCode/intCarrier)
|
||||||
val carrierList = MutableLiveData<List<KeyValue>>(
|
val carrierList = MutableLiveData<List<KeyValue>>(emptyList())
|
||||||
listOf(
|
|
||||||
KeyValue("MU - 东方航空", "MU"),
|
|
||||||
KeyValue("CA - 国航", "CA"),
|
|
||||||
KeyValue("CZ - 南方航空", "CZ"),
|
|
||||||
KeyValue("HO - 吉祥航空", "HO"),
|
|
||||||
KeyValue("FM - 上海航空", "FM"),
|
|
||||||
)
|
|
||||||
)
|
|
||||||
|
|
||||||
fun initOnCreate(intent: Intent) {
|
fun initOnCreate(intent: Intent) {
|
||||||
id = intent.getStringExtra(Constant.Key.ID) ?: ""
|
id = intent.getStringExtra(Constant.Key.ID) ?: ""
|
||||||
@@ -46,8 +39,13 @@ class UldEditViewModel : BaseViewModel() {
|
|||||||
pageType.value = if (id.isEmpty()) DetailsPageType.Add
|
pageType.value = if (id.isEmpty()) DetailsPageType.Add
|
||||||
else if (modify) DetailsPageType.Modify else DetailsPageType.Details
|
else if (modify) DetailsPageType.Modify else DetailsPageType.Details
|
||||||
|
|
||||||
|
if (id.isEmpty()) {
|
||||||
|
// 新增:直接加载航司列表
|
||||||
|
loadCarrierList(null)
|
||||||
|
} else {
|
||||||
getData()
|
getData()
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private fun getData() {
|
private fun getData() {
|
||||||
if (id.isEmpty()) return
|
if (id.isEmpty()) return
|
||||||
@@ -56,10 +54,18 @@ class UldEditViewModel : BaseViewModel() {
|
|||||||
}) {
|
}) {
|
||||||
onSuccess = {
|
onSuccess = {
|
||||||
uldBean.value = it.data ?: ULDBean()
|
uldBean.value = it.data ?: ULDBean()
|
||||||
|
// 编辑/详情:数据加载完成后再加载字典,将已选航司置顶回填
|
||||||
|
loadCarrierList(uldBean.value?.carrier)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun loadCarrierList(checkedValue: String?) {
|
||||||
|
DictUtils.getIntCarrierList(checkedValue = checkedValue?.ifEmpty { null }) {
|
||||||
|
carrierList.value = it
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fun onSaveClick() {
|
fun onSaveClick() {
|
||||||
val bean = uldBean.value ?: return
|
val bean = uldBean.value ?: return
|
||||||
if (bean.uld.isBlank()) {
|
if (bean.uld.isBlank()) {
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ import com.lukouguoji.module_base.ktx.showToast
|
|||||||
import com.lukouguoji.module_base.model.ConfirmDialogModel
|
import com.lukouguoji.module_base.model.ConfirmDialogModel
|
||||||
import com.lukouguoji.module_base.ktx.toRequestBody
|
import com.lukouguoji.module_base.ktx.toRequestBody
|
||||||
import com.lukouguoji.module_base.model.ScanModel
|
import com.lukouguoji.module_base.model.ScanModel
|
||||||
|
import com.lukouguoji.module_base.util.DictUtils
|
||||||
import dev.DevUtils
|
import dev.DevUtils
|
||||||
import dev.utils.app.info.KeyValue
|
import dev.utils.app.info.KeyValue
|
||||||
|
|
||||||
@@ -35,17 +36,8 @@ class UldListViewModel : BasePageViewModel() {
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
// 所属航司下拉列表(mock,后续替换为接口)
|
// 所属航司下拉列表(数据源:POST /typeCode/intCarrier)
|
||||||
val carrierList = MutableLiveData<List<KeyValue>>(
|
val carrierList = MutableLiveData<List<KeyValue>>(listOf(KeyValue("全部", "")))
|
||||||
listOf(
|
|
||||||
KeyValue("全部", ""),
|
|
||||||
KeyValue("MU - 东方航空", "MU"),
|
|
||||||
KeyValue("CA - 国航", "CA"),
|
|
||||||
KeyValue("CZ - 南方航空", "CZ"),
|
|
||||||
KeyValue("HO - 吉祥航空", "HO"),
|
|
||||||
KeyValue("FM - 上海航空", "FM"),
|
|
||||||
)
|
|
||||||
)
|
|
||||||
|
|
||||||
// 合计数量
|
// 合计数量
|
||||||
val count = MutableLiveData(0L)
|
val count = MutableLiveData(0L)
|
||||||
@@ -53,6 +45,13 @@ class UldListViewModel : BasePageViewModel() {
|
|||||||
val itemLayoutId = R.layout.item_uld_list
|
val itemLayoutId = R.layout.item_uld_list
|
||||||
val itemViewHolder = UldListViewHolder::class.java
|
val itemViewHolder = UldListViewHolder::class.java
|
||||||
|
|
||||||
|
init {
|
||||||
|
// 加载所属航司列表(addAll=true 保留“全部”作为筛选默认项)
|
||||||
|
DictUtils.getIntCarrierList(addAll = true) {
|
||||||
|
carrierList.value = it
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
override fun getData() {
|
override fun getData() {
|
||||||
launchLoadingCollect({
|
launchLoadingCollect({
|
||||||
NetApply.api.getUldList(
|
NetApply.api.getUldList(
|
||||||
|
|||||||
@@ -320,6 +320,12 @@ interface Api {
|
|||||||
@POST("typeCode/communicateType")
|
@POST("typeCode/communicateType")
|
||||||
suspend fun getCommunicateTypeList(): DictListBean
|
suspend fun getCommunicateTypeList(): DictListBean
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取所属航司列表(国际)
|
||||||
|
*/
|
||||||
|
@POST("typeCode/intCarrier")
|
||||||
|
suspend fun getIntCarrierList(): DictListBean
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询平板车信息
|
* 查询平板车信息
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -84,6 +84,24 @@ object DictUtils {
|
|||||||
KeyValue("出港库存至库区", "3"),
|
KeyValue("出港库存至库区", "3"),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取所属航司列表(国际)
|
||||||
|
*/
|
||||||
|
fun getIntCarrierList(
|
||||||
|
addAll: Boolean = false,
|
||||||
|
checkedValue: String? = null,
|
||||||
|
callBack: (List<KeyValue>) -> Unit
|
||||||
|
) {
|
||||||
|
launchCollect({
|
||||||
|
NetApply.api
|
||||||
|
.getIntCarrierList()
|
||||||
|
}) {
|
||||||
|
onSuccess = {
|
||||||
|
handleCallBack(it, checkedValue, addAll, callBack)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取代理列表
|
* 获取代理列表
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -11,7 +11,6 @@ import com.lukouguoji.module_base.common.ConstantEvent
|
|||||||
import com.lukouguoji.module_base.http.net.NetApply
|
import com.lukouguoji.module_base.http.net.NetApply
|
||||||
import com.lukouguoji.module_base.impl.FlowBus
|
import com.lukouguoji.module_base.impl.FlowBus
|
||||||
import com.lukouguoji.module_base.ktx.commonAdapter
|
import com.lukouguoji.module_base.ktx.commonAdapter
|
||||||
import com.lukouguoji.module_base.ktx.formatDate
|
|
||||||
import com.lukouguoji.module_base.ktx.launchCollect
|
import com.lukouguoji.module_base.ktx.launchCollect
|
||||||
import com.lukouguoji.module_base.ktx.launchLoadingCollect
|
import com.lukouguoji.module_base.ktx.launchLoadingCollect
|
||||||
import com.lukouguoji.module_base.ktx.noNull
|
import com.lukouguoji.module_base.ktx.noNull
|
||||||
@@ -20,7 +19,6 @@ import com.lukouguoji.module_base.ktx.toRequestBody
|
|||||||
import com.lukouguoji.module_base.model.ScanModel
|
import com.lukouguoji.module_base.model.ScanModel
|
||||||
import dev.utils.app.info.KeyValue
|
import dev.utils.app.info.KeyValue
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
import java.util.Date
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 国际出港-仓库 ViewModel
|
* 国际出港-仓库 ViewModel
|
||||||
@@ -28,7 +26,7 @@ import java.util.Date
|
|||||||
class IntExpStorageUseViewModel : BasePageViewModel() {
|
class IntExpStorageUseViewModel : BasePageViewModel() {
|
||||||
|
|
||||||
// ========== 筛选条件 ==========
|
// ========== 筛选条件 ==========
|
||||||
val flightDate = MutableLiveData(Date().formatDate()) // 航班日期,默认今天
|
val flightDate = MutableLiveData("") // 航班日期,默认为空(可手动选择)
|
||||||
val flightNo = MutableLiveData("") // 航班号
|
val flightNo = MutableLiveData("") // 航班号
|
||||||
val clearResult = MutableLiveData("") // 清仓综合结果
|
val clearResult = MutableLiveData("") // 清仓综合结果
|
||||||
val clearResultList = MutableLiveData<List<KeyValue>>() // 清仓综合结果列表
|
val clearResultList = MutableLiveData<List<KeyValue>>() // 清仓综合结果列表
|
||||||
|
|||||||
@@ -12,7 +12,6 @@ import com.lukouguoji.module_base.common.ConstantEvent
|
|||||||
import com.lukouguoji.module_base.http.net.NetApply
|
import com.lukouguoji.module_base.http.net.NetApply
|
||||||
import com.lukouguoji.module_base.impl.FlowBus
|
import com.lukouguoji.module_base.impl.FlowBus
|
||||||
import com.lukouguoji.module_base.ktx.commonAdapter
|
import com.lukouguoji.module_base.ktx.commonAdapter
|
||||||
import com.lukouguoji.module_base.ktx.formatDate
|
|
||||||
import com.lukouguoji.module_base.ktx.launchCollect
|
import com.lukouguoji.module_base.ktx.launchCollect
|
||||||
import com.lukouguoji.module_base.ktx.launchLoadingCollect
|
import com.lukouguoji.module_base.ktx.launchLoadingCollect
|
||||||
import com.lukouguoji.module_base.ktx.noNull
|
import com.lukouguoji.module_base.ktx.noNull
|
||||||
@@ -21,7 +20,6 @@ import com.lukouguoji.module_base.ktx.toRequestBody
|
|||||||
import com.lukouguoji.module_base.model.ScanModel
|
import com.lukouguoji.module_base.model.ScanModel
|
||||||
import dev.utils.app.info.KeyValue
|
import dev.utils.app.info.KeyValue
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
import java.util.Date
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 国际进港-仓库 ViewModel
|
* 国际进港-仓库 ViewModel
|
||||||
@@ -29,7 +27,7 @@ import java.util.Date
|
|||||||
class IntImpStorageUseViewModel : BasePageViewModel() {
|
class IntImpStorageUseViewModel : BasePageViewModel() {
|
||||||
|
|
||||||
// ========== 筛选条件 ==========
|
// ========== 筛选条件 ==========
|
||||||
val flightDate = MutableLiveData(Date().formatDate()) // 航班日期,默认今天
|
val flightDate = MutableLiveData("") // 航班日期,默认为空(可手动选择)
|
||||||
val flightNo = MutableLiveData("") // 航班号
|
val flightNo = MutableLiveData("") // 航班号
|
||||||
val clearResult = MutableLiveData("") // 清仓综合结果
|
val clearResult = MutableLiveData("") // 清仓综合结果
|
||||||
val clearResultList = MutableLiveData<List<KeyValue>>() // 清仓综合结果列表
|
val clearResultList = MutableLiveData<List<KeyValue>>() // 清仓综合结果列表
|
||||||
|
|||||||
Reference in New Issue
Block a user