feat: fix issues
This commit is contained in:
@@ -108,7 +108,14 @@ class IntImpLoadingListActivity :
|
||||
return
|
||||
}
|
||||
|
||||
IntImpModifyStorageDialogModel { dialog ->
|
||||
// 如果所有选中项库位相同,则预选该库位
|
||||
val commonLocation = selectedItems.map { it.locationTally }.distinct().let {
|
||||
if (it.size == 1) it.first() else ""
|
||||
}
|
||||
|
||||
IntImpModifyStorageDialogModel(
|
||||
currentLocationName = commonLocation
|
||||
) { dialog ->
|
||||
val locationName = dialog.locationName
|
||||
val locationId = dialog.locationId
|
||||
viewModel.performModifyStorage(locationName, locationId, selectedItems)
|
||||
|
||||
@@ -16,6 +16,7 @@ import dev.utils.app.info.KeyValue
|
||||
*/
|
||||
class IntImpModifyStorageDialogModel(
|
||||
private val currentLocationId: String = "",
|
||||
private val currentLocationName: String = "",
|
||||
private val callback: (IntImpModifyStorageDialogModel) -> Unit
|
||||
) : BaseDialogModel<DialogIntImpModifyStorageBinding>(DIALOG_TYPE_CENTER) {
|
||||
|
||||
@@ -55,9 +56,14 @@ class IntImpModifyStorageDialogModel(
|
||||
onSuccess = { result ->
|
||||
val list = result.data?.map { it.toKeyValue() } ?: emptyList()
|
||||
locationList.value = list
|
||||
// 列表加载完成后,预选当前库位
|
||||
// 列表加载完成后,预选当前库位(优先按ID匹配,其次按名称匹配)
|
||||
if (currentLocationId.isNotEmpty()) {
|
||||
selectedLocationCode.value = currentLocationId
|
||||
} else if (currentLocationName.isNotEmpty()) {
|
||||
val matched = list.find { it.key == currentLocationName }
|
||||
if (matched != null) {
|
||||
selectedLocationCode.value = matched.value
|
||||
}
|
||||
}
|
||||
}
|
||||
onFailed = { _, msg ->
|
||||
|
||||
@@ -107,6 +107,14 @@ class GjjManifestDetailsViewModel : BaseViewModel(), IGetData {
|
||||
remark.value = data.remark.noNull()
|
||||
date.value = data.storageTime.noNull()
|
||||
|
||||
// 初始化下拉控件的选中值(避免 onSelected 回调时机不确定导致值丢失)
|
||||
agent = data.agent.noNull()
|
||||
specialCode = data.spCode.noNull()
|
||||
businessType = data.businessType.noNull()
|
||||
packageType = data.packagecode.noNull()
|
||||
goodsType = data.cargoType.noNull()
|
||||
waybillType = data.awbType.noNull()
|
||||
|
||||
DictUtils.getAgentList(addAll = false, checkedValue = data.agent) {
|
||||
agentList.postValue(it)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user